On Apr 25, 2005, at 10:46 PM, Charles Hartman wrote:
Maybe this is the wrong place to ask. (I'm confused.) I've got a Mac 2.4.1 app using the unicode build of wxPython 2.5.4.1. I'm loading a text file that contains an accented (>128) character and displaying it in a wxPython widget (a StyledTextCtrl). I've got the encoding/decoding etc all taken care of (I think!) elsewhere inside the app. But now I have a problem right at the front end, reading and displaying the file.
It works fine in the WingIDE.
When I build it with py2app, though, I get a problem. If I use this:
self.myStyledTextCtrl.DisplayText(f.read())
the file is displayed up to the line that includes the accented character, then no more. If I use this:
defaultEncoding = wx.GetDefaultPyEncoding()
. . .
data = f.read()
self.WholeText.DisplayText(unicode(data, defaultEncoding))
the file doesn't display at all.
Because of the difference between standalone and in-the-IDE, I can't figure out where the problem lies. Any clues very welcome. (I'm getting very sick of unicode.)
The default encoding is dumb. Never use the default encoding. Pick something explicitly. I bet there's a difference in the default encoding between running in the IDE and running explicitly. One or the other is probably even raising an exception at unicode(data, defaultEncoding).
-bob
_______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig