[erlang-questions] io module encoding

Richard A. O'Keefe <>
Fri Jun 27 00:49:08 CEST 2014


I notice that you are just querying os:getenv("LC_CYTPE").
But it's a little more complicated.  To determine the value
of an LC_xxxx property:
 (1) First check LC_ALL.  If that's set, use it.  Otherwise,
 (2) next check LC_xxxx.  If that's set, use it.  Otherwise,
 (3) next check LANG.     If that's set, use it.  Otherwise,
 (4) use the default C locale.

While LC_CTYPE is set the same in both your examples,
it's possible that LC_ALL might be set differently.

Transcript:

sh% export LC_CTYPE=en_NZ.UTF-8 LC_ALL=en_NZ.ISO8859-1
sh% erl
1> io:getopts().
[...
 {encoding,latin1}]





More information about the erlang-questions mailing list