On 4/21/2010 9:29 AM, Peter Otten wrote:
pyt...@bdurham.com wrote:
Are you saying all open() calls in Python that read text files,
automatically convert UTF-8 content to Unicode in the same manner as the
following might when using Python 2.6?
codecs.open( fileName, mode='r', encoding='UTF8', .
Hi Peter,
>> Are you saying all open() calls in Python that read text files,
>> automatically convert UTF-8 content to Unicode in the same manner as the
>> following might when using Python 2.6?
>>
>> codecs.open( fileName, mode='r', encoding='UTF8', ... )
> That's what I meant to say, but it's
pyt...@bdurham.com wrote:
> Are you saying all open() calls in Python that read text files,
> automatically convert UTF-8 content to Unicode in the same manner as the
> following might when using Python 2.6?
>
> codecs.open( fileName, mode='r', encoding='UTF8', ... )
That's what I meant to say,
Hi Peter,
> Just a quick reminder: UTF-8 is not the same as unicode. Python3 works in
> unicode and by default uses UTF-8 to read from or write into files.
I'm not the OP, but wanted to make sure I was fully understanding your
point.
Are you saying all open() calls in Python that read text file
f...@slick.airforce-one.org wrote:
> I have taken the easy way out, I read on a page that python 3 worked
> by default in UTF-8, so I downloaded and installed it.
Just a quick reminder: UTF-8 is not the same as unicode. Python3 works in
unicode and by default uses UTF-8 to read from or write int
Thanks for your insights.
I have taken the easy way out, I read on a page that python 3 worked
by default in UTF-8, so I downloaded and installed it.
Apart from a few surprises (print is not a funtion, and rules about
mixing spaces and tabs in indentation are much more strict, and I
guess more is
On Wed, Apr 21, 2010 at 2:29 AM, wrote:
>> Change your string literals to unicode by adding the u-prefix and you should
>> be OK.
>
> Thanks, it solved the problem... for a while!
>
> I need now to know if s[i] gives the next byte or the next character,
> when I scan the string s. I've googled pa
> Change your string literals to unicode by adding the u-prefix and you should
> be OK.
Thanks, it solved the problem... for a while!
I need now to know if s[i] gives the next byte or the next character,
when I scan the string s. I've googled pages about python and unicode,
but didn't find a sol
f...@slick.airforce-one.org wrote:
> Hello.
>
> I read a string from an utf-8 file:
>
> fichierLaTeX = codecs.open(sys.argv[1], "r", "utf-8")
> s = fichierLaTeX.read()
> fichierLaTeX.close()
>
> I can then print the string without error with 'print s'.
>
> Next I parse this string:
>
> def pa