Tag Archives: encoding

Assigning UTF8 display strings in PythonOgre with CEGUI 0.6.2b

If you just do:

# Of course: cegui.wm=cegui.WindowManager.getSingleton()

then, despite “line” being UTF8, some piece of code will attempt to convert it into something “appropriate.” We don’t want that. We want our UTF8 string to be displayed with correct encoding, without guesses about what to convert it into — because the guess is incorrect! (It looks like it converts it into ascii or some Western European codepage).

So let’s force the wrapper to do the right thing:

line_cg=cegui.String(); line_cg.assign(line)

Or you may prefer a utility function which does that:

def getDisplayString(txt):
  return cg_string


This was necessary on PythonOgre SVN revision 996, wrapping Ogre 1.6.1 and CEGUI 0.6.2b for Python 2.5, on Mac. 
Image courtesy of Bart Simpson Chalkboard Generator from addletters.com