Strings (was: Re: are Mnesia tables immutable?)

Yariv Sadan yarivvv@REDACTED
Wed Jun 28 15:13:28 CEST 2006

> The problem with (1), is that we end up with a very inefficient
> external encoding of strings (as a list, see above). The real
> problem, is that we have no way to specify that a list is a
> string, and that it should be encoded, e.g. into UTF-8, when
> externally encoded e.g. by term_to_binary/1.
> In case (1), to have a more efficient representation of strings,
> encoding/decoding must be done by programmers explicitly, e.g.
> by doing:
> Pid ! to_utf8(String)
> instead of directly:
> Pid ! String
> But who does that? I have seen nobody caring about encoding of
> strings in Erlang code.

I've been hacking the JSON parser in Yaws, and I actually came across
usage of the undocumented (as far as I can see) xmerl_ucs module,
especially the to_utf8 and from_utf8 functions. I would have probably
never known about these functions had I not seen this code.


More information about the erlang-questions mailing list