Re: unicode + xml

2009-09-10 Thread Laurent Luce
Here is the code I use to receive the data: dom = minidom.parseString(request.raw_post_data) default charset on django side is utf-8. Please advise. Thanks. Laurent - Original Message From: Stefan Behnel To: python-list@python.org Sent: Monday, September 7, 2009 11:50:28 PM Subject:

Re: unicode + xml

2009-09-07 Thread Stefan Behnel
Laurent Luce wrote: > Can someone confirm that the issue here is I need to encode the xml data > using: > # encode as UTF-8 > utf8_string = xml.encode( 'utf-8' ) > and then post it to the server. Well, since you declared it to be UTF-8, it must be UTF-8 encoded. However, your question seems to i

Re: unicode + xml

2009-09-07 Thread Laurent Luce
eptember 7, 2009 10:50:22 PM Subject: Re: unicode + xml The xml data is generated on Windows (python 2.6.2) and sent using a post request to a Django server. The django server is running on Ubuntu server with python 2.6.2. The post data is passed to minidom for parsing. Laurent - Origin

Re: unicode + xml

2009-09-07 Thread Laurent Luce
@python.org Sent: Monday, September 7, 2009 9:15:15 PM Subject: Re: unicode + xml "Laurent Luce" wrote in message news:255473.44957...@web54203.mail.re2.yahoo.com... > Hello, > > I am trying to do the following: > > - read list of folders in a specific directory: os.listdir

Re: unicode + xml

2009-09-07 Thread Mark Tolonen
"Laurent Luce" wrote in message news:255473.44957...@web54203.mail.re2.yahoo.com... Hello, I am trying to do the following: - read list of folders in a specific directory: os.listdir() - some folders have Japanese characters - post list of folders as xml to a web server: I used content-type

unicode + xml

2009-09-07 Thread Laurent Luce
Hello, I am trying to do the following: - read list of folders in a specific directory: os.listdir() - some folders have Japanese characters - post list of folders as xml to a web server: I used content-type 'text/xml' and I use '' to start the xml data. - on the server side (Django), I get the

Re: Error when trying to write unicode xml to zipfile

2007-07-10 Thread Stefan Behnel
Martin v. Löwis wrote: >> Unless, obviously, you were serialising to a non-utf8 encoding. But since the >> "toxml()" method seems to return unicode here (which sounds surprising), I >> expect it a) to provide no XML declaration at all or b) to be broken anyway. > > Or c) the user forgot to specify

Re: Error when trying to write unicode xml to zipfile

2007-07-10 Thread Martin v. Löwis
> Unless, obviously, you were serialising to a non-utf8 encoding. But since the > "toxml()" method seems to return unicode here (which sounds surprising), I > expect it a) to provide no XML declaration at all or b) to be broken anyway. Or c) the user forgot to specify the encoding= parameter in to

Re: Error when trying to write unicode xml to zipfile

2007-07-10 Thread Stefan Behnel
Gabriel Genellina wrote: > En Mon, 09 Jul 2007 20:11:24 -0300, Martin <[EMAIL PROTECTED]> > escribió: > >> I get below error when trying to write unicode xml to a zipfile. >> >> zip.writestr('content.xml', content.toxml()) >> File "

Re: Error when trying to write unicode xml to zipfile

2007-07-09 Thread Gabriel Genellina
En Mon, 09 Jul 2007 20:11:24 -0300, Martin <[EMAIL PROTECTED]> escribió: > I get below error when trying to write unicode xml to a zipfile. > > zip.writestr('content.xml', content.toxml()) > File "/usr/lib/python2.4/zipfile.py", line 460, in writestr

Error when trying to write unicode xml to zipfile

2007-07-09 Thread Martin
I get below error when trying to write unicode xml to a zipfile. zip.writestr('content.xml', content.toxml()) File "/usr/lib/python2.4/zipfile.py", line 460, in writestr zinfo.CRC = binascii.crc32(bytes) # CRC-32 checksum UnicodeEncodeError: 'ascii'