[erlang-questions] cookbook entry #1 - unicode/UTF-8 strings

Vlad Dumitrescu <>
Fri Oct 21 11:57:04 CEST 2011


Hi,

On Fri, Oct 21, 2011 at 10:41, Angel J. Alvarez Miguel <> wrote:
> But right now it works!!
>
> Ive just added some national caracters into one of my strings and the seems
> survive the compilation step..
>                        ...io:format("Procesando ó ñ ü fichero ~s / ~s ~.16b ~n",
> [filename:dirname(Path),filename:basename(Path),Digest]),....
> thist outputs:
>
> Procesando ó ñ ü fichero /home/sinosuke / .bash_history
> 84a45c9c62121aec0d1860534377577a
>
> (Im using kate on OpenSSUE 11.4 X64 and erlang/OTP  R14B04 (erts-5.8.5) and my
> sources are in utf-8)

When you just use that string to feed to io:format, then it will work
if your OS console supports UTF-8, because the string is not
processed.

The problems appear when you for example want to do something with
that string, for example
X="ó ñ ü",
{string:len(X), string:to_upper(X)}

best regards,
Vlad



More information about the erlang-questions mailing list