This is the mail archive of the
cygwin
mailing list for the Cygwin project.
UTF-16 surrogate macros
- From: Andy Koppe <andy dot koppe at gmail dot com>
- To: Cygwin Tech List <cygwin at cygwin dot com>
- Date: Sun, 9 Aug 2009 12:42:04 +0100
- Subject: UTF-16 surrogate macros
w32api/winnls.h is lacking the macros for recognising UTF-16
surrogates: IS_HIGH_SURROGATE, IS_LOW_SURROGATE, IS_SURROGATE_PAIR.
Here's one way to define them, which avoids evaluating the characters
twice:
#define IS_HIGH_SURROGATE(c) (((c) & 0xFC00) == 0xD800)
#define IS_LOW_SURROGATE(c) (((c) & 0xFC00) == 0xDC00)
#define IS_SURROGATE_PAIR(hc,lc) (IS_HIGH_SURROGATE(hc) && IS_LOW_SURROGATE(lc))
Andy
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple