Hamlのコンパイル時にHaml error on line **: Invalid US-ASCII character "\xE3"と出るとき

次のようなエラーが出る。

$ haml index.haml 
Haml error on line 59: Invalid US-ASCII character "\xE3"
  Use --trace for backtrace.

そういえばgemをインストールするときに
次のようなエラーが出ることが多かったのが関係あるかも知れない。

$ gem install tilt
Successfully installed tilt-1.4.1
unable to convert U+3075 from UTF-8 to US-ASCII for test/tilt_erbtemplate_test.rb, skipping
unable to convert U+201C from UTF-8 to US-ASCII for test/tilt_markdown_test.rb, skipping
unable to convert U+3075 from UTF-8 to US-ASCII for test/tilt_template_test.rb, skipping
Installing ri documentation for tilt-1.4.1
1 gem installed

調べると、export LC_CTYPE="utf-8" すればいいらしい。
http://stackoverflow.com/questions/4975973/gem-update-unable-to-convert-xe7-to-utf-8-in-conversion-from-ascii-8bit-to-u

LC_CTYPEを設定するとHamlも直ってた。ビンゴ。