0

I am trying to print Unicode 220e: https://www.fileformat.info/info/unicode/char/220e/index.htm

It says the python sources code should be

print(u"\u220E")

Then I will get this:

UnicodeEncodeError: 'gbk' codec can't encode character '\u220e' in position 0: illegal multibyte sequence

Is there a way to fix?

jxie0755
  • 1,682
  • 1
  • 16
  • 35
  • 1
    Possible duplicate of [UnicodeEncodeError: 'gbk' codec can't encode character: illegal multibyte sequence](https://stackoverflow.com/questions/3218014/unicodeencodeerror-gbk-codec-cant-encode-character-illegal-multibyte-sequen) – Rhesous Jun 26 '18 at 15:21
  • Does your output terminal really use `gbk` as its native encoding? Then the error message is correct: there is no valid value it can convert U+220E to for your terminal to display. ∎ – Jongware Jun 26 '18 at 15:22
  • … as proof of this I ran your code snippet from inside Sublime Text (its stdout supports UTF8 and so it is capable of displaying every valid Unicode character). The result is, as I already expected: `∎` – Jongware Jun 26 '18 at 15:24
  • @usr2564301 I see! My terminal does not use gbk. So the problem is my output terminal instead of the code – jxie0755 Jun 26 '18 at 15:51

0 Answers0