1

Over the past few years there have been some Linux systems that will output strange characters when running various commands. Here's an example of my output from the sensors command on one of those machines:

acpitz-virtual-0
Adapter: Virtual device
temp1:        +45.5°C  (crit = +126.0°C)

coretemp-isa-0000
Adapter: ISA adapter
Core 0:       +44.0°C  (high = +100.0°C, crit = +100.0°C)
Core 1:       +45.0°C  (high = +100.0°C, crit = +100.0°C)

nouveau-pci-0100
Adapter: PCI adapter
temp1:        -62.0°C  (high = +95.0°C, crit = +99.0°C)

Notice the  character all over the place. Why does this happen in some environments and not others? What can I do to correct this?

9

Either use a terminal program that understands UTF-8, or tell your shell to not use UTF-8 via $LANG.

>>> print u'°'.encode('utf-8').decode('latin-1')
°
  • 1
    Thanks, I realized I hadn't set this up in Putty on Windows. That is where the problem was happening, not when using the terminal in various Linux distros. My mistake! – Aaron Sep 18 '13 at 13:27
  • In this case PuTTY would be your terminal program. – Ignacio Vazquez-Abrams Sep 18 '13 at 16:01
  • This worked for me. Single quotes had turned into â on PuTTY, but it was fixed after I changed the Window > Translation > Remote character set to UTF8 – andrewtweber Jul 19 '14 at 0:54
  • In my case I was seeing strange characters when logging in from Solaris 10 to Linux. I did export LC_ALL=en_IE.UTF-8 on the Linux host and set the Solaris terminal character encoding to UTF-8. It was fine after that. – Philip Kearns Sep 1 '16 at 14:13
2

You should set your locale to C:

export LC_ALL=C

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.