After recently installing Ubuntu 11.10 onto my Mac mini, I’ve been mildly annoyed when I connect to it through PuTTY from my Windows machine. It’s working fine, except gcc displays a weird “â” character instead of quotes in its error messages. I figured it was some weird locale or terminal setting I hadn’t configured properly in Ubuntu because I did a minimal install with only a few server packages, but I was dead wrong. I tried SSHing to a standard Ubuntu 11.10 install with a regular desktop environment and everything, and it still had the weird character in PuTTY!
It turns out that it’s really simple — PuTTY defaults to an ISO-8859-1 character set and Ubuntu defaults to a UTF-8 character set. All I had to do was change my PuTTY settings to use UTF-8 instead:
(The highlight is kind of hard to see, but I clicked “Translation” underneath the “Window” category on the left side to get to that screen.)
After making that change in PuTTY, it works perfectly. Passing the gcc output to hexdump -C shows that the quote characters are represented as:
0xE2 0x80 0x98
and
0xE2 0x80 0x99
(which are UTF-8 sequences for ‘ and ’, respectively). Sure enough, 0xE2 in ISO-8859-1 is â, and 0x80, 0x98, and 0x99 are C1 control codes, which don’t actually display a character. So that’s the “why” behind this whole situation.
I know this probably seems like a simple thing to write a blog post about, but sometimes it’s kind of freaky when you do a minimal install of a Linux distribution and little glitches like this pop up because you forgot to install or configure a standard package that everyone tends to use. Even though that wasn’t the case here, I know others will run into the same problem and suspect the same thing I did originally, so I hope this helps someone else out (and maybe teaches a little bit of trivia in the process)!
That was very helpful. Thanks a ton
Awesome. I’ve been living with this issue for years and didn’t know where to begin troubleshooting. Thanks.
Thank you.
Thanks for this tip! This is the first result on google for “quotes not displaying in putty”
Thanks for posting this! It fixed the gibberish in my gcc output.
Things like this are not talked about much and that’s when blog posts like this come handy. Thanks a ton!
I finally got tired of the extended-character A. Thank you for explaining this super-simple method. You seem to imply that an install option bigger than “minimal linux” install prevents this from occurring. Have you tested that? If so, what package can I include in my build-out so I don’t have to configure the ssh clients in the future?
Hey Brian,
No — I never found any evidence for that idea I mentioned in the post. The reason I thought “minimal linux” might be related was because I had never noticed it on previous desktop Linux installs I did, but I think in hindsight it was just because my desktop installs were older versions of Ubuntu. Every modern Linux install I’ve seen defaults to UTF-8 and needs this PuTTY fix.
Thanks to everyone for your kind comments on this post! I’m glad it helped!
Thanks! This was bugging me too. I didn’t know if it was a PuTTY thing or gcc. Looks like a combination. It would be nice if gcc would just use the standard single quotes instead of the “curly” ones for broader compatibility, but at least now I know how to fix it.
Confirmed this on a wide variety of Unix boxen. I never realised they were all outputting UTF-8!
Have set this in my PuTTY Default Settings so it will be used for new servers.
Minor addition: UTF-8 is sometimes not immediately visible because it’s at the top of the drop-down, above 8859.
TVM