[erlang-questions] convert UTF-8 encoded string to atom.

Bob Ippolito bob@REDACTED
Sat May 19 23:43:03 CEST 2007


On 5/19/07, Stephen Han <kruegger@REDACTED> wrote:
> Hi.
>
> I need your advice on converting UTF-8 encoded string into atom.
>
> 1. Is there any function that I can use?
> 2. Will it be a problem, having non-printable character-based atom within
> virtual machine?
> 3. What will be the good approach where in a situation that code converts
> accepted string to atom when sometime that string is UTF-8 format. I know
> that the atom is not garbaged collected but assuming that I have limited
> number of string that won't overflow the atom table within the virtual
> machine.

It doesn't care what your string is encoded as, so long as it's a list of bytes.

1> list_to_atom([0,255]).
'\000\377'

-bob



More information about the erlang-questions mailing list