RichTextCtrl.GetValue, returns unicode with values > 127, is this a bug ?

hello,

I don’t understand much of ascii / unicode,

I only know that it’s crime if you collect data from different sources.

RichTextCtrl returns a unicode-object.

Typing special characters, like é ö

returns a unicode with values above 127,

and thus the result can’t be written to a file.

Finally I found that encoding the unicode to a string, makes it
possible to save the string to a file:

line = RichTextCtrl_Instance.GetValue ()

line = line.encode('windows-1252')

Is this normal behavior or is this a bug ?

thanks,

Stef Mientki

Hi,

···

On Mon, Feb 1, 2010 at 10:50 AM, Stef Mientki <stef.mientki@gmail.com> wrote:

hello,

I don't understand much of ascii / unicode,
I only know that it's crime if you collect data from different sources.

RichTextCtrl returns a unicode-object.
Typing special characters, like é ö
returns a unicode with values above 127,
and thus the result can't be written to a file.

Finally I found that encoding the unicode to a string, makes it possible to
save the string to a file:
line = RichTextCtrl_Instance.GetValue ()
line = line.encode('windows-1252')

Is this normal behavior or is this a bug ?

If your using the Unicode build of wxPython then yes this is normal
behavior. All in memory text is treated as unicode you need to convert
to the proper encoded string when writing to disk and also need to
convert from the string to Unicode when reading a file from disk into
memory.

Cody