![]() |
Unicode support
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? Thanks, Richard |
Re: Unicode support
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 |
| All times are GMT. The time now is 11:01 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.