Unicode support
Peter Hansen
peter at engcorp.com
Fri Aug 6 09:52:20 EDT 2004
Richy2004 wrote:
> I've experienced problems when trying to load a text file encoded with
> 2byte unicode characters. No matter what combination of the following
> I try, I always get an error when
> executing file.readline()
>
> file = open("file.txt", "r")
> file = open("file.txt", "rb")
> file = codecs.open("file.txt", "rb", "utf-16")
> file = unicode(open("file.txt", "r"), "utf-16")
>
> Even more strangely it does work when used in the interactive
> interpreter.
>
> Any ideas?
Always post the actual traceback (cut and pasted from another window)
when saying you are getting an error. That avoids lots of guessing
on our part as to what is going on.
-Peter
More information about the Python-list
mailing list