The Pug Automatic

Displaying UTF-8 correctly in Leopard Terminal

Written October 28, 2007. Tagged OS X.

On my fresh Leopard install, UTF-8 didn't quite work in Terminal.


After discussions with Allan who had noticed similar issues, it seems that this issue is due to some bug you may run into when customizing your region formats in the International preference pane; so see this post as a solution if you run into that as well.

If you haven't customized the formats, or you selected a region and later customized that, you probably don't have this issue.

A file named täst was displayed by e.g. ls as


This was even after adding

export LC_CTYPE=sv_SE.UTF-8

as described in desp's guide. You might want to set en_US.UTF-8 if you're American, and so on.

Unchecking the "Set LANG environment variable on startup" checkbox in the Terminal settings, under the "Advanced" tab, fixes it though. I've tested this in both bash and zsh.

When the box is checked, the locale command returns (among other things)


It seems to overwrite my LC_CTYPE. With it unchecked, I get


and ls now displays


as it should.