Encoding problem in python

Laszlo Nagy gandalf at shopzeus.com
Mon Mar 4 04:57:41 EST 2013


On 2013-03-04 10:37, yomnasalah91 at gmail.com wrote:
> I have a problem with encoding in python 27 shell.
>
> when i write this in the python shell:
>
> w=u'العربى'
>
> It gives me the following error:
>
> Unsupported characters in input
>
> any help?
Maybe it is not Python related. Did you get an exception? Can you send a 
full traceback? I suspect that the error comes from your terminal, and 
not Python. Please make sure that your terminal supports UTF-8 encoding. 
Alternatively, try creating a file with this content:


# -*- encoding: UTF-8 -*-
w=u'العربى'

Save it as UTF-8 encoded file "test.py" (with an UTF-8 compatible 
editor, for example Geany) and run it as a command:


python test.py

If it works then it is sure that the problem is with your terminal. It 
will be an OS limitation, not Python's limitation.

Best,

    Laszlo



More information about the Python-list mailing list