[Pythonmac-SIG] py2app, unicode, etc

Bob Ippolito bob at redivi.com
Fri Apr 29 04:50:57 CEST 2005


On Apr 28, 2005, at 9:57 AM, Charles Hartman wrote:

> I'm using Python 2.4.1 with wxPython 2.5.4.1 Unicode build. While 
> tracking down messy little problems with string-vs-unicode stuff, I 
> put some code like this in my app:
> 		defEng = wx.GetDefaultPyEncoding()
> 		print 'default encoding is %s' % defEng
> If I run this from within the WingIDE debugger, I get
> 		default encoding is mac-roman
> If I run it from the command line, I get
> 		default encoding is mac-roman
> If I use py2app to build a standalone, I get
> 		default encoding is utf-8
>
> How come?

Because wx.GetDefaultPyEncoding() is weird.  It should be returning 
'ascii' (because that's python's default default encoding), but for 
some reason it is returning 'mac-roman'.  However, py2app sets the 
default encoding to utf-8 because that's what the encoding of 
terminal/console/etc. are. and apparently wx's weird function is 
picking that up.

-bob



More information about the Pythonmac-SIG mailing list