[erlang-questions] Downcase Accented characters

Thomas Allen thomas@REDACTED
Sun Oct 21 22:12:09 CEST 2012


On Sun, October 21, 2012 3:39 pm, Roberto Ostinelli wrote:
> For the records, this just works..
>
> start() ->
> Unicode = list_to_binary("∞-HOpe@☺.EXAMple.com/My❤"),
> Result = list_to_binary(string:to_lower(binary_to_list(Unicode))),
> "∞-hope@☺.example.com/my❤" = binary_to_list(Result).
>
> any downsides I'm not seeing?

For what it's worth,

1> list_to_binary("∞-HOpe@☺.EXAMple.com/My❤").
** exception error: bad argument
     in function  list_to_binary/1
        called as
list_to_binary([8734,45,72,79,112,101,64,9786,46,69,88,65,77,112,108,101,
                                  46,99,111,109,47,77,121,10084])

I get that on my system if any of the special characters (∞,
☺, ❤) are present (R15B02 on Debian 6.0.6 and OSX 10.7.2,
both built from source). So you might need to be careful with that
technique.

Thomas Allen




More information about the erlang-questions mailing list