1

I am working in Python 2.7, and trying Chinese in string but it is not accepting at all.

I tried .encode('utf-8') as explained in ,

UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in position 20: ordinal not in range(128)

and adding below line in the beginning of file but none worked.

# -- coding: utf-8 --

To check I opened console in Pycharm and entered below string. You may check the output below. I don't understand this behaviour.

enter image description hereThanks in advance.

qurat
  • 439
  • 1
  • 7
  • 14
  • Possible duplicate of [UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in position 20: ordinal not in range(128)](https://stackoverflow.com/questions/9942594/unicodeencodeerror-ascii-codec-cant-encode-character-u-xa0-in-position-20) – msanford Jan 31 '18 at 20:17
  • Ok. I got the issue. The code works fine in python with u'ウィメン'. There is something wrong with Pycharm console. – qurat Feb 01 '18 at 07:33

0 Answers0