[Tutor] input file encoding

Tim Golden mail at timgolden.me.uk
Tue Sep 11 12:58:37 CEST 2007


Kent Johnson wrote:
> Tim Golden wrote:

>> Not sure what you mean by "standard encoding" (is this an Ubuntu
>> thing?) 
> 
> Probably referring to the encoding the terminal application expects - 
> writing latin-1 chars when the terminal expects utf-8 will not work well.

Ah, I see. I'm so used to Windows where there is, technically an encoding
for the console window, but you can't really do anything about
it (apart from the awkward chcp) and it isn't really in your face. I
do *use* Linux sometimes, but I don't really think in it :)

 >> Tim Golden
>>    # you could do this:
>>    # text = text.encode ("utf-8")
>>    print repr (text)
> 
> No, not repr, that will print with \ escapes and quotes.

I knew that (no, honestly ;). Since I wasn't sure what
the OP was after, I was using repr to *show* the escapes
and quotes really to indicate that he may not have wanted
them! (All right, I'll shut up now). Thanks for clarifying,
Kent.


TJG


More information about the Tutor mailing list