Python Forum
how do i get utf-8 encoding for real?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how do i get utf-8 encoding for real?
#2
I have mention before that there most be something wrong with you Terminal/shell encoding.
Here some test you can do.
I use Mint 18.1 with Python 3.6.2.
If see LANG=C or similar, Python will use an ASCII encoder.
mint@mint ~ $ locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
mint@mint ~ $ python
Python 3.6.2 (default, Aug  6 2017, 12:55:04) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.getdefaultlocale()
('en_US', 'UTF-8')
>>> locale.getpreferredencoding()
'UTF-8'
>>> exit()
mint@mint ~ $ python -c "import sys; print(sys.stdout.encoding)"
UTF-8
mint@mint ~ $ python -c "print('Spicy jalapeño ☂')"
Spicy jalapeño ☂
Reply


Messages In This Thread
how do i get utf-8 encoding for real? - by Skaperen - Dec-03-2017, 05:33 AM
RE: how do i get utf-8 encoding for real? - by snippsat - Dec-03-2017, 01:48 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020