[erlang-questions] Erlang 3000?
Richard O'Keefe
ok@REDACTED
Fri Nov 21 04:00:50 CET 2008
On 21 Nov 2008, at 9:02 am, Toby Thain wrote:
>
> On 19-Nov-08, at 9:49 PM, Richard O'Keefe wrote:
>
>> ...
>> The whole idea of a 1-1 lower-upper case mapping is historically
>> absurd.
>
>
> char toupper(char c){ return c & ~0x20; }
>
> The ASCII guys told me this would work everywhere, forever. Was I
> misled??
Not even for ASCII. Consider this: '~' is not a lower case letter,
so upcasing should leave it alone. But '~' &~ 0x20 is '^'. OOPS!
(This is one of the things that C89 changed. Classic C only really
defined toupper(x) on characters that satisfied tolower(x), but C89
defined it for _all_ characters.)
It certainly doesn't work for Latin-1, where there are two lower
case letters that have no (y-umlaut) or no single-character (sharp s)
upper case version at all in Latin 1.
It doesn't work in most members of the ISO 8859 family,
including for example ISO Latin 9 (8859-15), which is the
replacement for Latin-1 that has the Euro (a wallaby-like
marsupial).
More information about the erlang-questions
mailing list