Re: convert strings to utf-8

2007-02-25 Thread John Nagle
Diez B. Roggisch wrote: > Niclas schrieb: > >> Thank you! >> >> solved it with this: >> unicode( data.decode('latin_1') ) > > > The unicode around this is superfluous. Worse, it's an error. utf-8 needs to go into a stream of 8-bit bytes, not a Unicode string.

Re: convert strings to utf-8

2007-02-25 Thread Diez B. Roggisch
Niclas schrieb: > Thank you! > > solved it with this: > unicode( data.decode('latin_1') ) The unicode around this is superfluous. Either do unicode(bytestring, encoding) or bytestring.decode(encoding) > and when I write it to the file... > f = codecs.open(path, encoding='utf-8', mod

Re: convert strings to utf-8

2007-02-25 Thread Niclas
Thank you! solved it with this: unicode( data.decode('latin_1') ) and when I write it to the file... f = codecs.open(path, encoding='utf-8', mode='w+') f.write(self.__rssDoc.toxml()) Diez B. Roggisch skrev: > Niclas schrieb: >> Hi >> >> I'm having trouble to work with the spec

Re: convert strings to utf-8

2007-02-25 Thread Martin v. Löwis
Niclas schrieb: > I'm having trouble to work with the special charcters in swedish (Å Ä Ö > å ä ö). The script is parsing and extracting information from a webpage. > This works fine and I get all the data correctly. The information is > then added to a rss file (using xml.dom.minidom.Document() to

Re: convert strings to utf-8

2007-02-25 Thread Diez B. Roggisch
Niclas schrieb: > Hi > > I'm having trouble to work with the special charcters in swedish (Å Ä Ö > å ä ö). The script is parsing and extracting information from a webpage. > This works fine and I get all the data correctly. The information is > then added to a rss file (using xml.dom.minidom.Do

convert strings to utf-8

2007-02-25 Thread Niclas
Hi I'm having trouble to work with the special charcters in swedish (Å Ä Ö å ä ö). The script is parsing and extracting information from a webpage. This works fine and I get all the data correctly. The information is then added to a rss file (using xml.dom.minidom.Document() to create the file