Sharmila Sivakumar added the comment:

Oops Facundo, that will work.   It actually fails *
after the dom construction* when you do

mydom.firstChild.childNodes

I request you to try it again.

The prob is there is some encoding and decoding done within the parser, and
it uses the default encoding 'ascii'.  This fails for utf-8 data.

On 10/18/07, Sharmila Sivakumar <[EMAIL PROTECTED]> wrote:
>
>
> Sharmila Sivakumar added the comment:
>
> Thanks for your quick response Facundo.
>
> I'm working on Ubuntu 7.04, python 2.5.1
> Python 2.5.1 (r251:54863, May 2 2007, 16:56:35)
> [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
>
> This error occurs when the default encoding is 'ascii'.  When I change the
> default encoding to 'utf-8' it works for me too.  Is, by any chance, your
> default encoding 'utf-8'?
>
> On 10/18/07, Facundo Batista <[EMAIL PROTECTED]> wrote:
> >
> >
> > Facundo Batista added the comment:
> >
> > Downloaded the testdata.txt file, and yes, it's UTF-8:
> >
> > [EMAIL PROTECTED]:~/devel$ file testdata.txt
> > testdata.txt: UTF-8 Unicode text
> >
> > But I opened it perfectly!
> >
> > Python 2.5.1 (r251:54863, May  2 2007, 16:56:35)
> > [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
> > Type "help", "copyright", "credits" or "license" for more information.
> > >>> import xml.dom.minidom as dom
> > >>> data = open('testdata.txt','r').read()
> > >>> mydom = dom.parseString(data)
> > >>> mydom
> > <xml.dom.minidom.Document instance at 0xb7c03b0c>
> > >>>
> >
> > In which platform you're working?
> >
> > And yes, you have absolute permission to fix it, patchs are always
> > welcomed!
> >
> > ----------
> > nosy: +facundobatista
> > resolution:  -> works for me
> > status: open -> closed
> >
> > __________________________________
> > Tracker <[EMAIL PROTECTED]>
> > <http://bugs.python.org/issue1290>
> > __________________________________
> >
>
> Added file: http://bugs.python.org/file8559/unnamed
>
> __________________________________
> Tracker <[EMAIL PROTECTED]>
> <http://bugs.python.org/issue1290>
> __________________________________
>

Added file: http://bugs.python.org/file8560/unnamed

__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1290>
__________________________________
Oops Facundo, that will work. &nbsp;&nbsp;It actually 
fails&nbsp;<i>after&nbsp;the&nbsp;dom&nbsp;construction</i> when you do 
<br><br>mydom.firstChild.childNodes<br><br>I request you to try it 
again.<br><br>The prob is there is some encoding and decoding done within the 
parser, and it uses the default encoding &#39;ascii&#39;. &nbsp;This fails for 
utf-8 data.
<br><br><div><span class="gmail_quote">On 10/18/07, <b 
class="gmail_sendername">Sharmila Sivakumar</b> &lt;<a href="mailto:[EMAIL 
PROTECTED]">[EMAIL PROTECTED]</a>&gt; wrote:</span><blockquote 
class="gmail_quote" style="margin-top: 0; margin-right: 0; margin-bottom: 0; 
margin-left: 0; margin-left: 0.80ex; border-left-color: #cccccc; 
border-left-width: 1px; border-left-style: solid; padding-left: 1ex">
<br>Sharmila Sivakumar added the comment:<br><br>Thanks for your quick response 
Facundo.<br><br>I&#39;m working on Ubuntu 7.04, python 2.5.1<br>Python 2.5.1 
(r251:54863, May 2 2007, 16:56:35)<br>[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4
)] on linux2<br><br>This error occurs when the default encoding is 
&#39;ascii&#39;.&nbsp;&nbsp;When I change the<br>default encoding to 
&#39;utf-8&#39; it works for me too.&nbsp;&nbsp;Is, by any chance, 
your<br>default encoding &#39;utf-8&#39;?
<br><br>On 10/18/07, Facundo Batista &lt;<a href="mailto:[EMAIL 
PROTECTED]">[EMAIL PROTECTED]</a>&gt; wrote:<br>&gt;<br>&gt;<br>&gt; Facundo 
Batista added the comment:<br>&gt;<br>&gt; Downloaded the testdata.txt
 file, and yes, it&#39;s UTF-8:<br>&gt;<br>&gt; [EMAIL PROTECTED]:~/devel$ file 
testdata.txt<br>&gt; testdata.txt: UTF-8 Unicode text<br>&gt;<br>&gt; But I 
opened it perfectly!<br>&gt;<br>&gt; Python 2.5.1 (r251:54863, May&nbsp;&nbsp;2 
2007, 16:56:35)
<br>&gt; [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2<br>&gt; Type 
&quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or 
&quot;license&quot; for more information.<br>&gt; &gt;&gt;&gt; import 
xml.dom.minidom as dom
<br>&gt; &gt;&gt;&gt; data = 
open(&#39;testdata.txt&#39;,&#39;r&#39;).read()<br>&gt; &gt;&gt;&gt; mydom = 
dom.parseString(data)<br>&gt; &gt;&gt;&gt; mydom<br>&gt; 
&lt;xml.dom.minidom.Document instance at 0xb7c03b0c&gt;<br>
&gt; &gt;&gt;&gt;<br>&gt;<br>&gt; In which platform you&#39;re 
working?<br>&gt;<br>&gt; And yes, you have absolute permission to fix it, 
patchs are always<br>&gt; welcomed!<br>&gt;<br>&gt; ----------<br>&gt; nosy: 
+facundobatista
<br>&gt; resolution:&nbsp;&nbsp;-&gt; works for me<br>&gt; status: open -&gt; 
closed<br>&gt;<br>&gt; __________________________________<br>&gt; Tracker 
&lt;<a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>&gt;<br>&gt; &lt;
<a 
href="http://bugs.python.org/issue1290";>http://bugs.python.org/issue1290</a>&gt;<br>&gt;
 __________________________________<br>&gt;<br><br>Added file: <a 
href="http://bugs.python.org/file8559/unnamed";>http://bugs.python.org/file8559/unnamed
</a><br><br>__________________________________<br>Tracker &lt;<a 
href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>&gt;<br>&lt;<a 
href="http://bugs.python.org/issue1290";>http://bugs.python.org/issue1290</a>&gt;
<br>__________________________________<br></blockquote></div><br>

_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to