Unicode strings - How to?

  • easy

    easy - 2008-03-17

    Hi all,

    For several hours I try to make Boa accept utf-8 strings. After reading Boa heplp I'we put sitecustomize.py in both Boa directory and site-packages.
    Unfortunately I still see label='\xe0' instead of label=u'ą'.

    What do I do wrong?

    # sitecustomize.py 
    # this file can be anywhere in your Python path,
    # but it usually goes in ${pythondir}/lib/site-packages/

    import sys


    • easy

      easy - 2008-03-17

      After some experiments i get label=u'\u0105' instead of label=u'ą'. And I am at the point to tink about geting back to eclipse+glade.... :(

      • Werner F. Bruhin

        First of all you should define what coding you use within each script by adding a line at the top of your files, something along these lines:

        # -*- coding: utf-8 -*-#

        At this point I can enter any kind of special characters without problems, e.g.:

                self.staticText1 = wx.StaticText(id=wxID_FRAME1STATICTEXT1,
                      label=u'éõÿëÄ©', name='staticText1', parent=self.panel1,
                      pos=wx.Point(0, 0), size=wx.Size(55, 13), style=0)

        Here a link to Unicode and Python which I found useful.

        Note I currently don't put special chars directly into my script files.  My application is I18n enabled using gettext, so I enter all the strings to be translated in english and then use gettext/poedit to translate it and handle special characters like accents etc.

        Hope this helps, see you


Log in to post a comment.