[Tutor] symbol encoding and processing problem

Kent Johnson kent37 at tds.net
Thu Oct 18 19:52:27 CEST 2007


Timmie wrote:
>> Was the problem with the print statements? Maybe changing the console 
>> encoding would help. I have some notes here:
>> http://personalpages.tds.net/~kent37/stories/00018.html
> Thanks, I read it yesterday evening.
> 
> I still don't know why there is such a encoding mess on Python. For me this
> totally neglects the statement that python code is easily portable or executable
> on other platforms.

I don't think this is entirely fair. For example at the start you had a 
file containing cp1252 data but told Python it was utf-8. You can't 
really expect Python to just do the right thing in such circumstances.

Encoding issues require a certain amount of understanding of the 
underlying issues. In my experience most programmers find it confusing 
at first but it eventually sorts out.

> For instance, I am also unsing some IDL code. There I open the IDLE and code
> right away without worring about the encoding.

Does you IDL code include non-ascii characters? Perhaps you would do 
better if you stuck with ascii for your Python source code, too - there 
is no need to include non-ascii characters directly, you can use \x 
string escapes to insert them into your strings.

Kent


More information about the Tutor mailing list