wxPython and Croatian characters

Diez B. Roggisch deets at nospam.web.de
Mon Feb 16 14:06:53 EST 2009


vedrandekovic at gmail.com schrieb:
> Hello,
> 
> I have problem with configuring my wxPython script to work with
> Croatian characters like:  đ,š,ž,č,ć.
> Here is my simple script without wxPython (this script works):
> 
>       # -*- coding: utf-8 -*-
>       s = "hello normal string đšžćč"
>       print s
> 
> ..here is my snippet with wxPython:
> 
>     text = wx.StaticText(self, -1,"Matični broj",(0,100)) # in this
> example,we have character "č"
> 
> ...when I run this text, it looks something like:  "Mati",some weird
> characters ,and "ni"

Unless you are using python 3.0 (which I doubt, afaik no wx available), 
your above coding declaration is useless for the shown piece of code, as 
it only applies to unicode literals, which are written with a preceding u.

So

u"mönsch ist doch nicht so schwer"


gives you an unicode literal, that wx might work with (don't know wx)

And of course you need to make sure your editor produces utf-8 as 
output, otherwise the exercise is futile as well.

Diez



More information about the Python-list mailing list