Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't input (č ć š ž đ ) in python 2.7.x console

So , I've searching trough internet and it is so frustrating. When I try to search I get explanations on how to unicode decode and encode files. But I'm not interested in that. I know this is possible since I was able to do that. I don't know what happened. Also, I've tried reinstalling python. Changing the options under the configure IDLE etc. On my laptop there are no problems at all. I can do this:

>> a = 'ć'
>>
>> print a
>> ć

And on my PC I get:

 >> a = 'ć'
 >> Unsupported characters in input

I repeat, I'm not talking about encoding in the program. I'm talking about Python console, and it works on my laptop and worked on my previous machines. There's got to be a solution to this issue.

Also, take look at this:

>>> a = u'ç'
>>> a
u'\xe7'
>>> print a
ç
>>> a = u'ć'
Unsupported characters in input

>>> 
like image 841
H3NDRX Avatar asked Nov 26 '22 15:11

H3NDRX


1 Answers

The Windows console is limited in what it can display. You can change the code page using the old DOS CHCP command.

CHCP 65001

This will change the code page to UTF-8, and make the console more relaxed. You will probably see a square instead of the actual character, but at least you won't see an error.

like image 64
zmbq Avatar answered Dec 21 '22 15:12

zmbq