Strings and Unicode

christof hoeke csad7 at
Sun Jul 20 15:16:53 CEST 2003

- wrote:
> I have a function that takes a string as an input parameter. This
> function then urlencodes the string and sends it to a server with
> telnetlib.Telnet
> The problem is that the string gets converted into what seems to be
> Unicode. How can I check to see if the input-string is Unicode and
> convert it to a different character set (in this case ISO-Latin1).

to test if it is unicode simply check the type

    print type(string)

converting seems to be working by using the encode function of unicode

    isostring = unicodestring.encode('iso8859-1')

i am not really experienced in python and its unicode processing but this
worked at least partly for me


More information about the Python-list mailing list