Hi, I am probably missing something (I don't use rtc very extensively
and don't really understand the usage of Handlers etc., but it seems,
that the wxpython demo app for rtc displays the same garbage like your
app; i.e. the utf-8 file is read using windows-1252.
On the other hand using a straightforward
self.notepad.SetValue(unicode(open(path, "r").read(),
"utf-8", "strict"))
instead of
self.notepad.LoadFile(path, fileType)
I get 我在学中文 in the richtext field.
(Of course, normally you would use more robust code around open(...),
, e.g. with ..., or try... except, or codecs.open(...).)
hth,
vbr
···
2010/2/13 Mark Reed <markreed99@gmail.com>:
I'm trying to display Chinese in a RichTextControl, using utf-8 encoding.
I'm doing:
for h in rt.RichTextBuffer.GetHandlers():
h.SetEncoding("utf-8")
But I get garbage when I load in a utf-8 encoded file. I've attached a
simple script and text file that displays the problem.
Thanks
Mark
--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en