From: Kenneth P. <ken...@ce...> - 2006-02-02 03:46:27
|
On Wed, Feb 01, 2006 at 09:41:18PM -0600, Kenneth Pronovici wrote: > On Thu, Feb 02, 2006 at 03:10:23AM +0000, Alex Tweedly wrote: > > If I start up the Python interpreter (i.e. open a DOS shell box, and=20 > > type "python") I get my Python interpreter. I then type in the followin= g=20 > > two lines, and get an error : > >=20 > > >C:\Documents and Settings\Eleane>python > > >Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)]= =20 > > >on win32 > > >Type "help", "copyright", "credits" or "license" for more information. > > >>>> s =3D u'a\u2019s' > > >>>> print s > > >Traceback (most recent call last): > > > File "<stdin>", line 1, in ? > > > File "C:\Python24\lib\encodings\cp850.py", line 18, in encode > > > return codecs.charmap_encode(input,errors,encoding_map) > > >UnicodeEncodeError: 'charmap' codec can't encode character u'\u2019'= =20 > > >in position > > > 1: character maps to <undefined> > > >>>> > >=20 > > If instead I start the PythonCard codeEditor, and start a Shell (F5),= =20 > > and type the same two lines, it works properly. > >=20 > > I tried the basic python interpreter adding the imports that are visibl= e=20 > > within the codeEditor shell, but still get the same problem. >=20 > Unicode in Python drives me batty. Every time I think I understand > what's going on, something else strange happens, and I begin to doubt my > comprehension. So, it's not just you. :) >=20 > I get this same behavior on Linux (python 2.3.5). On that platform, > I suspect (but haven't had time to prove) that the problem is > locale-related. However, even if I figure it out there, I'm not sure > how that solution would translate to other platforms like Windows. >=20 > I suggest writing python-devel with "unicode" in the subject somewhere. > Posts with that subject often get quite excellent replies from Martin v. > L=F6wis, who has in fact helped me out several times. Ugh, I have Debian on the brain. I meant <pyt...@py...>, not python-devel. KEN --=20 Kenneth J. Pronovici <pro...@ie...> http://www.cedar-solutions.com/ |