0

A have a trouble. I try to execute this code:

print('')

My main language in system is Russian, it prints correctly, but if I change system language to English I have error.

UnicodeEncodeError: 'ascii' codec can't encode character '\U0001f48e' in position 0: ordinal not in range(128)

I there any way to use English language as main in system and print same emojis without error? I use MacOS and Python 3.6.2.

Arr
  • 749
  • 3
  • 6
  • 15
  • 2
    Did you try setting the coding to `utf-8`? – cs95 Oct 02 '17 at 15:53
  • It seems your terminal encoding is set to ascii, set it to utf-8 – juanpa.arrivillaga Oct 02 '17 at 15:54
  • @cᴏʟᴅsᴘᴇᴇᴅ, yes, but it don't work anyway – Arr Oct 02 '17 at 16:35
  • @juanpa.arrivillaga, yes, I try it by run `export LC_ALL=en_US.UTF-8 ` and `export LANG=en_US.UTF-8` – Arr Oct 02 '17 at 16:36
  • Right, but that is your *system encoding*, the problem is when you try to write to your terminal. What is your *terminal* encoding? What terminal emulator are you using? – juanpa.arrivillaga Oct 02 '17 at 16:41
  • I use iTerm2. A try to execute this code with that config: Russian language: on my local machine from iTerm I have no errors while print it, on my droplet by connect over ssh from iTerm I have no errors. But if change system language on my system to English, on my machine I don't have error, but I have error on my server. There is an error when I'm connected to my server via ssh with English system language, but if the language of my system from which I'm connected to the server is Russian, then there are no errors. – Arr Oct 02 '17 at 17:04

0 Answers0