> The same rules apply as apply everywhere else that you need to deal
> with string data. By far the best solution is to decode to/from
> strings at the borders of your application and use only unicode
> internally.
To make that clear with your example:
2. "Right" way:
msg = u"Could be a fatal string"
wx.MessageBox( msg, "", wx.OK )
so pass only unicode objects to wxPython.
Where did your "could be a fatal string" come from? when you get that is when you should handle the decoding, as Chris (the other one) said.
I also assume that if the user has the ansi build
You're really better off just making your app a unicode app, and not supporting the ANSI build at all.
-Chris
···
On Dec 19, 2007 12:39 PM, Donn Ingle <donn.ingle@gmail.com> wrote:
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
You're really better off just making your app a unicode app, and not supporting the ANSI build at all.
Especially since starting in wx 2.9 there will no longer be an ANSI build, and in Python 3.0 there will no longer be the separate string and unicode classes, the string class will be essentially what the unicode class is today, and a new non string-like class will be available for collections of bytes, such as when reading/writing from/to a file.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
msg = u"Could be a fatal string"
wx.MessageBox( msg, "", wx.OK )
so pass only unicode objects to wxPython.
Where did your "could be a fatal string" come from? when you get that is
when you should handle the decoding, as Chris (the other one) said.
I am opening font files and they can have any kind of weird family names and
file names. I need to pass those strings into various places in the app.
But I take the hint : convert everything to Unicode. It's a little tricky
when I don't know the encoding of the strings within font family names, but
I'll use ignore (at a minimum) to get around that and decode everything
with UTF-8.