Erlang: convert any string to binary utf8
I took half a day, until I found a wonderful module xmerl_ucs. It is available in Erlangen R14B
uniconvert(String) ->
try xmerl_ucs:from_utf8(String) of
_ ->
list_to_binary(String)
catch
exit:{ucs,{bad_utf8_character_code}} ->
list_to_binary(xmerl_ucs:to_utf8(String))
end.
Читайте також:
- md5 в Erlang
- Webmachine redirect resource example
- Agner: a repository of libraries and applications
- Erlang: cpu usage
- QR-code erlang library
- Tutorial: Developing in Erlang with Webmachine, ErlyDTL, and Riak
- Erlang: Hello World
- kerl - easy building and installing of Erlang/OTP instances
- Mustache is a framework templating system
- Wrong charset, conversion from `utf-8' to `windows-1251' is not allowed chroot