Edward K Ream <[EMAIL PROTECTED]> added the comment:
On Mon, Aug 18, 2008 at 11:00 AM, Antoine Pitrou <[EMAIL PROTECTED]>wrote:
>
> Antoine Pitrou <[EMAIL PROTECTED]> added the comment:
>
> > Just to be clear, I am at present totally confused about io streams :-)
>
> Python 3.0 distincts more clearly between unicode strings (called "str"
> in 3.0) and bytes strings (called "bytes" in 3.0). The most important
> point being that there is no more any implicit conversion between the
> two: you must explicitly use .encode() or .decode().
>
> Files opened in binary ("rb") mode returns byte strings, but files
> opened in text ("r") mode return unicode strings, which means you can't
> give a text file to 3.0 library expecting a binary file, or vice-versa.
>
> What is more worrying is that XML, until decoded, should be considered a
> byte stream, so sax.parser should accept binary files rather than text
> files. I took a look at test_sax and indeed it considers XML as text
> rather than bytes :-(
Thanks for these remarks. They confirm what I suspected, but was unsure of,
namely that it seems strange to be passing something other than a byte
stream to parser.parse.
>
> Bumping this as critical because it needs a decision very soon (ideally
> before beta3).
Thanks for taking this seriously.
Edward
P.S. I love the new unicode plans. They are going to cause some pain at
first for everyone (Python team and developers), but in the long run they
are going to be a big plus for Python.
EKR
--------------------------------------------------------------------
Edward K. Ream email: [EMAIL PROTECTED]
Leo: http://webpages.charter.net/edreamleo/front.html
--------------------------------------------------------------------
Added file: http://bugs.python.org/file11148/unnamed
_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3590>
_______________________________________
<div dir="ltr"><br><br><div class="gmail_quote">On Mon, Aug 18, 2008 at 11:00
AM, Antoine Pitrou <span dir="ltr"><<a href="mailto:[EMAIL
PROTECTED]">[EMAIL PROTECTED]</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;">
<br>
Antoine Pitrou <<a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>>
added the comment:<br>
<br>
> Just to be clear, I am at present totally confused about io streams :-)<br>
<br>
Python 3.0 distincts more clearly between unicode strings (called
"str"<br>
in 3.0) and bytes strings (called "bytes" in 3.0). The most
important<br>
point being that there is no more any implicit conversion between the<br>
two: you must explicitly use .encode() or .decode().<br>
<br>
Files opened in binary ("rb") mode returns byte strings, but files<br>
opened in text ("r") mode return unicode strings, which means you
can't<br>
give a text file to 3.0 library expecting a binary file, or vice-versa.<br>
<br>
What is more worrying is that XML, until decoded, should be considered a<br>
byte stream, so sax.parser should accept binary files rather than text<br>
files. I took a look at test_sax and indeed it considers XML as text<br>
rather than bytes :-(</blockquote><div><br>Thanks for these remarks. They
confirm what I suspected, but was unsure of, namely that it seems strange to be
passing something other than a byte stream to parser.parse.<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>
Bumping this as critical because it needs a decision very soon (ideally<br>
before beta3).</blockquote><div><br>Thanks for taking this
seriously.<br><br>Edward<br><br>P.S. I love the new unicode plans.
They are going to cause some pain at first for everyone (Python team and
developers), but in the long run they are going to be a big plus for Python.<br>
<br>EKR<br></div></div>--------------------------------------------------------------------<br>Edward
K. Ream email: <a href="mailto:[EMAIL PROTECTED]">[EMAIL
PROTECTED]</a><br>Leo: <a
href="http://webpages.charter.net/edreamleo/front.html">http://webpages.charter.net/edreamleo/front.html</a><br>
--------------------------------------------------------------------<br><br>
</div>
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com