473,394 Members | 1,765 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Changing default encoding

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

Jul 18 '05 #1
2 2036
"jean.moser" <je********@wanadoo.fr> writes:
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
Jul 18 '05 #2
Martin v. Löwis wrote:
"jean.moser" <je********@wanadoo.fr> writes:
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?

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:
'áÃ*' # implicit repr '\xe1\xed'
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:
print 'áÃ*'

áÃ*

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/


Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Fuzzyman | last post by:
Sorry if my terminology is wrong..... but I'm having intermittent problems dealing with accented characters in python. (Only from the 8 bit latin-1 character set I think..) I've written an...
10
by: David Komanek | last post by:
Hi all, I have a question if it is possible to manipulate the settings of character encoding in Ms Internet Explorer 5.0, 5.5 and 6.0. The problem is that the default instalation of Ms IE seems...
2
by: Mrozik | last post by:
Hi! i read and update data from database that have ISO-8859-2 code page set default my application (windows app) run in polish code page (win1250) how can i read data and show them to user in...
5
by: Mark Fox | last post by:
Hello, When you add a new web form in VS.NET it automatically adds the following namespaces at the top: using System; using System.Collections; using System.ComponentModel; using...
2
by: John Dalberg | last post by:
The below html validates correctly on w3.org's html validator when the file has an html extension. When the same file gets an aspx extension, I get the error below from the validator. This tells me...
2
by: lprisr | last post by:
Hi, I have double byte characters in the content that I am returning using Web Services. However, the encoding in the xml file returned by Web Services is utf-8 and I am unable to read the...
5
by: pb | last post by:
Do anyone know how to change the .aspx extension to something else, say ..sssx, for all or part of a ASP.NET 2.0 site? I recall a Microsoft article on this some time ago, but I cannot locate it.
0
by: Ben | last post by:
I have an aspx page without anything special on it - just some English and Korean mixed text. My current advanced save encoding is set to Korean Codepage 949 (I don't know how it became that) and...
7
by: Jeffrey Spoon | last post by:
Hello, I'm a bit stuck trying to convert a text file which contains extended ASCII text and changing the ASCII values so they become readable. I do this by subtracting 127 from the ASCII value....
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.