[erlang-questions] Downcase Accented characters

Roberto Ostinelli <>
Sun Oct 21 21:45:21 CEST 2012


BTW,

ux dependencies are unsatisfied:

==> ux (get-deps)
Pulling abnfc from {git,"git://github.com/nygge/abnfc.git","master"}
Cloning into 'abnfc'...
Pulling metamodule from {git,"git://github.com/freeakk/metamodule.git",
                             "master"}
fatal: remote error:
  Repository not found.
Cloning into 'metamodule'...
ERROR: git clone -n git://github.com/freeakk/metamodule.git metamodule
failed with error: 128 and output:
fatal: remote error:
  Repository not found.
Cloning into 'metamodule'...

ERROR: 'get-deps' failed while processing



On Sun, Oct 21, 2012 at 12: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?
>
> On Sun, Oct 21, 2012 at 12:25 PM, Roberto Ostinelli <>wrote:
>
>> Thank you Loïc,
>>
>> did you happen to benchmark it? Would that be better/faster than a simple
>> list_to_binary(string:to_lower(binary_to_list(Bin)))?
>>
>>
>> On Sun, Oct 21, 2012 at 12:18 PM, Loïc Hoguin <> wrote:
>>
>>> On 10/21/2012 09:14 PM, Roberto Ostinelli wrote:
>>>
>>>> Dear list,
>>>>
>>>> I've a binary string which includes accented characters and unicode,
>>>> that i need to downcase.
>>>>
>>>> Is my real best option here to convert everything to list and downcase
>>>> that?
>>>>
>>>
>>> Your current best option is ux_string:to_lower/1 from the ux library
>>> which will properly lower all characters, not just A-Z.
>>>
>>> Should be at https://github.com/erlang-**unicode/ux<https://github.com/erlang-unicode/ux>
>>>
>>> --
>>> Loďc Hoguin
>>> Erlang Cowboy
>>> Nine Nines
>>> http://ninenines.eu
>>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20121021/44604ee0/attachment.html>


More information about the erlang-questions mailing list