unicode woes

Radovan Garabik spam at melkor.dnp.fmph.uniba.sk
Thu Sep 26 09:18:52 EDT 2002


Ulli Stein <mennosimons at gmx.net> wrote:
 : But nevertheless you would have to use everywhere the Python unicode() 
 : function.

 : Or how would you do this (nonsense string):
 : str = str + "blaäö" + str[:5] + "ßüä"

 : Would you write then:
 : str = str + unicode("blaäö") + str[:5] + unicode("ßüä")?

I ran into the same problem and find out that python2.3
handles this.
Just add the line
# -*- coding: UTF-8 -*-
as the second line of your python script and then
you can use all your strings in UTF-8 encoding
(or any other, whatever fits you)

-- 
 -----------------------------------------------------------
| Radovan Garabík  http://melkor.dnp.fmph.uniba.sk/~garabik |
| __..--^^^--..__         garabik @ fmph . uniba . sk       |
 -----------------------------------------------------------
Antivirus alert: file .signature infected by signature virus.
Hi! I'm a signature virus! Copy me into your signature file to help me spread!



More information about the Python-list mailing list