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

Angel J. Alvarez Miguel clist@REDACTED
Fri Oct 21 12:29:48 CEST 2011


On Viernes, 21 de Octubre de 2011 11:57:04 usted escribió:
> Hi,
> 
> On Fri, Oct 21, 2011 at 10:41, Angel J. Alvarez Miguel <clist@REDACTED> 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
Yes I know that string functions doesnt play well with unicode string. Yet 
last year didnt work even simple printing via io: functions...


regards Angel



More information about the erlang-questions mailing list