Characters aren't displayed correctly

Philip Semanchuk philip at semanchuk.com
Mon Mar 2 11:27:45 EST 2009


On Mar 2, 2009, at 10:50 AM, John Machin wrote:

> On Mar 3, 2:22 am, Philip Semanchuk <phi... at semanchuk.com> wrote:
>> See if you can successfully construct and send an email that says
>> "Hello world" in English/ASCII. If that works, change it to Arabic.  
>> If
>> that works, change the email format to HTML. If that works, starts
>> pulling the content from the database. If that works, then you're
>> done. =)
>
> Yuk. You are asking him to write extra speculative code when he's
> having extreme difficulty debugging the code he's already got! He's
> already said he's getting ?????? soon after the database retrieval ---
> you want him to work on the downstream problem when the upstream is
> still very muddy???

First of all, I preceded that paragraph with a detailed example of how  
to verify that he's getting what he expects out of the database. So  
no, I am not asking the OP to write extra speculative code. I'm giving  
him another tool with which to work at his problem.

He claims to have done what I asked him to do in the first place --  
break the problem into steps and verify the database steps. He says  
they're working OK. I chose to take him at his word.

If he's right, then we can move on to the next step of troubleshooting  
the email. If he's wrong and the problem is indeed with the database  
code, then we'll eventually discover that and he'll have learned a  
valuable lesson. It will be time-consuming and therefore painful for  
him, but then he'll be more likely to remember it.

There's more than one way to attack this problem/set of problems, yes?

This is all kind of OT since it is about general debugging and not  
about Python. The only Python-specific aspect I see is that debugging  
non-ASCII problems with print is a little tricky since it introduces  
yet another variable -- the terminal's encoding settings. If, for  
instance, the OP's terminal is set to ISO 8859-6 or some such (I don't  
know anything about encodings to handle Arabic) and he's feeding it  
UTF-8, then ??????? might indeed be the result.





More information about the Python-list mailing list