string title() method does not work on Danish characters

Michael Hudson mwh at python.net
Thu Feb 28 18:22:27 CET 2002


"Jason Orendorff" <jason at jorendorff.com> writes:

> Max M wrote:
> > Thanks for the suggestion, but it does not solve my problem. I am 
> > pulling the data from an older MS SQL server that returns standard ascii.
> 
> If it contains characters >127, it's not standard ASCII.
> It's probably ISO-8859-1, aka Latin-1, aka Western Europe.
> 
> If you're getting this data back as 8-bit strings, then you need
> to convert them to unicode first:
> 
> ustr = s.decode('latin-1')

This is 2.2 only.  In 2.1 you should use

ustr = unicode(s, "latin-1")

> ustr = ustr.title()

Cheers,
M.

-- 
  If I had wanted your website to make noise I would have licked
  my finger and rubbed it across the monitor.
                           -- signature of "istartedi" on slashdot.org



More information about the Python-list mailing list