[erlang-questions] Bug in string:to_{lower,upper}/1?
Richard O'Keefe
ok@REDACTED
Fri Oct 10 06:16:20 CEST 2008
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.
While these functions are not export,
they are the guts of to_lower/1 and to_upper/1.
More information about the erlang-questions
mailing list