erlang的汉字字符串和二进制的相互转换,并还原成汉字打印

 

19> Hanzi = <<"汉字"/utf8>>.                
<<230,177,137,229,173,151>>
20> io:format("~ts",[Hanzi]).
汉字ok
21> io:format("~w",[Hanzi]). 
<<230,177,137,229,173,151>>ok
22> unicode:characters_to_binary("中国").
<<228,184,173,229,155,189>>

 

 

 

 

 

posted @ 2014-05-21 22:40  宁静的天空  阅读(4952)  评论(0编辑  收藏  举报