all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* UNIBYTE_STR_AS_MULTIBYTE_P and UTF-8
@ 2006-10-26 18:57 Chip Coldwell
  0 siblings, 0 replies; only message in thread
From: Chip Coldwell @ 2006-10-26 18:57 UTC (permalink / 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-10-26 18:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-26 18:57 UNIBYTE_STR_AS_MULTIBYTE_P and UTF-8 Chip Coldwell

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.