[erlang-questions] Bug in string:to_{lower,upper}/1?

Bjorn Gustavsson bgustavsson@REDACTED
Fri Oct 10 10:26:08 CEST 2008


On Fri, Oct 10, 2008 at 6:16 AM, Richard O'Keefe <ok@REDACTED> wrote:

> In string.erl we find
>
> to_lower_char(C) when is_integer(C),  C >= $A, C =< $Z ->
>     C + 32;
> to_lower_char(C) when is_integer(C),  C >= 16#C1, C =< 16#D6 ->
>     C + 32;
> to_lower_char(C) when is_integer(C),  C >= 16#D8, C =< 16#DE ->
>     C + 32;
> to_lower_char(C) ->
>     C.
>
> to_upper_char(C) when is_integer(C),  C >= $a, C =< $z ->
>     C - 32;
> to_upper_char(C) when is_integer(C),  C >= 16#E1, C =< 16#F6 ->
>     C - 32;
> to_upper_char(C) when is_integer(C),  C >= 16#F8, C =< 16#FE ->
>     C - 32;
> to_upper_char(C) ->
>     C.
>
> But 16#C0 is capital A with grave,
> which is an upper case letter that should be converted,
> and to_lower_char/1 does not recognise it.
> I think 16#C1 should be 16#C0.
>
> And 16#E0 is lower case A with grave,
> which is a lower case letter that should be converted,
> but to_upper_char/1 does not recognise it.
> I think 16#E1 should be 16#E0.
>

Thanks for pointing this out.

We will correct this problem in R12B-5.

/Bjorn

-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20081010/144e59f8/attachment.htm>


More information about the erlang-questions mailing list