From: Chip Coldwell <coldwell@redhat.com>
Subject: UNIBYTE_STR_AS_MULTIBYTE_P and UTF-8
Date: Thu, 26 Oct 2006 14:57:01 -0400 (EDT) [thread overview]
Message-ID: <Pine.LNX.4.64.0610261452501.2371@localhost.localdomain> (raw)
I'm looking at the C macro UNIBYTE_STR_AS_MULTIBYTE_P defined in
src/charset.h, which starts out with this
#define UNIBYTE_STR_AS_MULTIBYTE_P(str, length, bytes) \
(((str)[0] < 0x80 || (str)[0] >= 0xA0) \
? ((bytes) = 1) \
: /* lots, lots more */
So, if the value at str[0] is less than 0x80 or greater than 0xA0,
this macro returns the value one, and sets "bytes" to one.
That's fine for ASCII (always one byte wide) and ISO-8859-1 (with
special characters between 0xA0 and 0xFF), but what about UTF-8?
There are multibyte characters in UTF-8 with the first byte > 0xA0; it
doesn't seem to me that this macro will work for general UTF-8
strings.
Chip
--
Charles M. "Chip" Coldwell
Senior Software Engineer
Red Hat, Inc
978-392-2426
reply other threads:[~2006-10-26 18:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=Pine.LNX.4.64.0610261452501.2371@localhost.localdomain \
--to=coldwell@redhat.com \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.