wxButton, label and utf-8

Hello all,

on a debain sarge with wxPython 2.4.2.6
when i create a button with

wxButton(self, wxNewId(), self.map[i].encode("utf-8"))

and "map" : a list of accent letter and other things in utf-8
no problem :slight_smile: the button have the good label not @A#0 ...

But (there is always a but ...) when i change the font with

font = button.GetFont()
font.SetPointSize(16)
font.SetWeight(wxBOLD)
button.SetFont(font)

The label goes to a strange @A#06@:; or something like that :slight_smile:

Any idea ?

rangzen wrote:

Hello all,

on a debain sarge with wxPython 2.4.2.6
when i create a button with

wxButton(self, wxNewId(), self.map[i].encode("utf-8"))

and "map" : a list of accent letter and other things in utf-8
no problem :slight_smile: the button have the good label not @A#0 ...

But (there is always a but ...) when i change the font with

font = button.GetFont()
font.SetPointSize(16)
font.SetWeight(wxBOLD)
button.SetFont(font)

The label goes to a strange @A#06@:; or something like that :slight_smile:

Any idea ?

Probably the default font used by the widget supports utf-8 encoding but when the new font is being created it is using whatever it thinks your default system ecoding is. You could try explitity setting the encoding of the font, but perhaps using a unicode build of wxPython would be better.

路路路

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Probably the default font used by the widget supports utf-8 encoding but
when the new font is being created it is using whatever it thinks your
default system ecoding is. You could try explitity setting the encoding
of the font, but perhaps using a unicode build of wxPython would be
better.

I just tried the demo.py of wxpython yesterday and i had a surprise : the
wxpython is NOT build by default with utf-8 support in the debian package
...
I have to explore this ...

Thank you !

路路路

--

Freedom - Share - Respect