How to set proper chracter encoding for GNU/Linux
Your default charset is Latin-1 (aka. ISO 8859-1). This charset does not seem to contain the character ™
. Chances are your JVM runs with this default because your system is configured to use Latin-1. You make sure that both your system and your JVM use UTF-8.
See How to get terminal's Character Encoding
Which character encoding is the IPython terminal using?
IPython uses OEM code page in the interactive mode like any other Python console program:
In [1]: '\u2552'
ERROR - failed to write data to stream: <_io.TextIOWrapper name='<stdout>' mode=
'w' encoding='cp850'>
Out[1]:
In [2]: !chcp
Active code page: 850
The result changes if pyreadline
is installed (it enables colors in the IPython console among other things):
In [1]: '\u2552'
Out[1]: '╒'
In [2]: import sys
In [3]: sys.stdout.encoding
Out[3]: 'cp850'
In [4]: !chcp
Active code page: 850
Once pyreadline
has been installed, IPython's sys.displayhook
writes the result to readline's console object that uses WriteConsoleW()
Windows Unicode API that allows to print even unencodable in the current code page Unicode characters (to see them, you might need to configure a (TrueType) font such as Lucida Console in the Windows console).
Related Topics
Bluetooth Low Energy: Listening For Notifications/Indications in Linux
How to Loop Over the Output of a Shell Command
How to Create Docker Overlay Network Between Multi Hosts
Git Asks For Username Every Time I Push
How to Replace a String in Multiple Files in Linux Command Line
How to Obtain the Number of Cpus/Cores in Linux from the Command Line
Controlling a Usb Power Supply (On/Off) With Linux
How to Rename All Folders and Files to Lowercase on Linux
How to View the List of Functions a Linux Shared Library Is Exporting
How to Loop Over Directories in Linux
Which Linux Ipc Technique to Use
"/Usr/Bin/Ld: Cannot Find -Lz"
Return Value of Sed For No Match
Modify Qt Gui from Background Worker Thread
How to Upgrade Glibc from Version 2.12 to 2.14 on Centos
What Does Localhost Means Inside a Docker Container
Why Data and Stack Segments Are Executable
Pseudo-Terminal Will Not Be Allocated Because Stdin Is Not a Terminal