<br><br><div class="gmail_quote">On Wed, Feb 18, 2009 at 8:43 AM, Gabriel Rossetti <span dir="ltr"><<a href="mailto:gabriel.rossetti@arimaz.com">gabriel.rossetti@arimaz.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello everyone,<br>
<br>
I originally posted this on the Twisted mailing list, but now it seams to be  a more general python/environment problem. If I run the attached example in Eclipse, it works, if I run it from a terminal, it doesn't, I get :<br>

<br>
$ python xml_parser_test.py<br>
Traceback (most recent call last):<br>
 File "xml_parser_test.py", line 30, in <module><br>
   res = rawXmlToElement("<t>reçu</t>")<br>
 File "xml_parser_test.py", line 21, in __call__<br>
   tmp.addRawXml(s)<br>
 File "/usr/lib/python2.5/site-packages/twisted/words/xish/domish.py", line 538, in addRawXml<br>
   self.children.append(SerializedXML(rawxmlstring))<br>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 5: ordinal not in range(128)<br>
<br>
Does anyone understand why it doesn't work outside of Eclipse? My OS is Linux (Ubuntu 8.04).<br>
<br>
Thank you,<br><font color="#888888">
Gabriel<br>
</font></blockquote><div><br><br>It's an encoding problem. My guess is that, in eclipse, the default encoding is UTF-8 or some other unicode-based encoding. In the console, it seems the encoding defaults to ascii. When twisted attempts to turn your byte string into a Unicode string, it sees a character that isn't in the encoding and choke up. Try using a unicode string instead of a byte string.<br>
 </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
<br></blockquote></div><br>