Weird symbols always appearing in command line (putty / zsh)

I've had this problem for a while and I hope it's a pretty easy fix:

In various places, I'll see weird symbols appearing in the command line. Such as 'â'. It seems like it's replacing some other character..? For example, when I do

prompt -p

I'll get lots of 'â symbols. Such as:

fade theme with parameters `white grey blue':
ââââuser@hostââââ Sun Sep 05 05:57:20pm
_cwd}~/ command arg1 arg2 ... argn

user and host replaced my actual user / host, but everything else looks exactly like that.

I've also seen those symbols in g++ compiler messages, such as:

test.cpp: In function âint main()â:
test.cpp:6: warning: unused variable âxâ

What's going on and what can I do to fix it? The shell I'm using is zsh (but I also see the symbols in bash). I'm using ubuntu and putty. Thanks!


Solution 1:

Your PuTTY character set and your terminal character set don't match. Use echo "$LANG" and look after the period for what it should be, and set it in PuTTY.

Solution 2:

Your terminal is outputting characters encoded using UTF-8, but PuTTY is interpreting the bytes it is seeing in another character set (probably ISO-8859-1).

You can change PuTTY to use UTF-8 by changing the 'received data assumed to be in which character set' option under Window\Translation: