From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
To: linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>
Subject: The kernel's ctype
Date: Wed, 04 Feb 2015 12:18:11 +0100 [thread overview]
Message-ID: <87iofiapsc.fsf@rasmusvillemoes.dk> (raw)
Hi,
The kernel's ctype is almost, but not quite, equivalent to latin1. Apart
from whether one wants to include the C1 control chars (0x80-0x9f),
there are a few other differences. For example, 0xb5 (MICRO SIGN) is, at
least according to glibc, both alpha and lower, while the kernel
classifies it as punct. A slightly surprising quirk of the kernel's
ctype implementation is that toupper() is not idempotent: Both 0xdf
(LATIN SMALL LETTER SHARP S) and 0xff (LATIN SMALL LETTER Y WITH
DIAERESIS) are correctly classified as lower, but since neither
character's uppercase version is representable in latin1, correct
toupper() behaviour would be to return the character itself. Instead, we
have toupper(0xff) == 0xdf and toupper(0xdf) == 0xbf.
Digging in pre-git history, I see that ctype.c was originally ASCII-only,
which I think is the only sane choice. It was changed around 1996, but
the commit log that I've found just says "Import 2.0.1", so it's hard to
tell what the intention was.
What would break if ctype.c was changed back to ASCII?
Rasmus
next reply other threads:[~2015-02-04 11:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-04 11:18 Rasmus Villemoes [this message]
2015-02-12 11:10 ` Frans Klaver
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87iofiapsc.fsf@rasmusvillemoes.dk \
--to=linux@rasmusvillemoes.dk \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®