Changing default encoding

J

jean.moser

Hi !

I need help to solve the problem of the special characters used by european western languages, for example French.
Word is my word-processing tool.I can save the files in txt format but special characters like é are transformed in \xe9 when I read the files in Python. How do I proceed to get the original files in latin-1 ?
Thanks for your help.

Jean
 
M

Martin v. =?iso-8859-15?q?L=F6wis?=

jean.moser said:
Word is my word-processing tool.I can save the files in txt format
but special characters like é are transformed in \xe9 when I read
the files in Python.

That is not the case. They are not transformed to \xe9. Why do you
believe such a transformation happens?
How do I proceed to get the original files in latin-1 ?

They still have the original latin-1.

Regards,
Martin
 
M

Mike C. Fletcher

Martin said:
That is not the case. They are not transformed to \xe9. Why do you
believe such a transformation happens?
He is likely looking at a repr( value ) and seeing the (safe)
representation with the hexadecimal escapes. Many people new to
programming may get confused by this. That is, he sees this:

and doesn't realise that those particular escaped values are the latin-1
escaped characters, he was expecting the accented characters to show
up. Doing this will help him see that the data is still in string (not
unicode) format:
áí

Knowing that Python supports unicode, new programmers may very easily
get confused by the escapes and assume they are part of some weird
"unicode encoding".

BTW, original poster, the actual encoding is quite probably not latin-1,
but the default Microsoft Windows encoding, such as 'cp1252'. Luckily,
as long as you're not trying to convert to Unicode you don't have to
care :) .

Enjoy,
Mike

_______________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://members.rogers.com/mcfletch/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top