[erlang-questions] strange problem with national chars

Angel Alvarez <>
Fri Jun 11 09:53:13 CEST 2010


Hi again

It seems that source erlang must be in latin1, so saving mytest.erl as latin1 yields the desired result, in the spirit of

http://www.erlang.org/doc/apps/stdlib/unicode_usage.html

that clearly says that erlang strings are latin1, i used to put english messages in my toy programms, but now i 
need to make an app in spanish

How can i use utf8 tools (text editors) and still get strings ok without converting them prior to compile to latin1??



Regards, Angel


El Viernes, 11 de Junio de 2010 09:16:43 Angel Alvarez escribió:
> Hi
> 
> Ive been in trouble trying to display localised messages in spanish.
> 
> While inputting strings in utf8 seems fine, every string compile into the code gets garbled. Terminal, text editor and shell are in unicode (utf8)
> but i can display messages with strings in spanish.
> 
> 
> Anyone can point me on the ritght direcction?
> 
> Thanks!!!
> 
> 
> /Angel
> 
> io:getopts().
> [{expand_fun,#Fun<group.0.120017273>},
>  {echo,true},
>  {binary,false},
>  {encoding,unicode}]
> 
> -module(mytest).
> -compile(export_all).
> 
> kk() ->  
> 	io:format("Test message with in-code spanish chars: cigüeña, camión~n",[]).
> kk(Message) ->  
> 	io:format("Test message with in-code spanish chars: cigüeña, camión and inputted spanish chars: ~s~n",[Message]).
> 
> :~/Datos/Personal/Erlang> erl
> Erlang R13B01 (erts-5.7.2) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]
> 
> Eshell V5.7.2  (abort with ^G)
> 1> mytest:kk().
> Test message with in-code spanish chars: cigüeña, camión
> ok
> 2> mytest:kk("Atención").
> Test message with in-code spanish chars: cigüeña, camión and inputted spanish chars: Atención
> ok
> 
> 
> 
> 



-- 
Este correo no tiene dibujos. Las formas extrañas en la pantalla son letras.
__________________________________________

Clist UAH a.k.a Angel
__________________________________________
Evitar la programación defensiva. Manual de Erlang


More information about the erlang-questions mailing list