00001 00002 00003 #ifndef NPS_UTF8ISVALID_H 00004 #define NPS_UTF8ISVALID_H 00005 00006 #if !defined BUILDING_UTF8ISVALID && !defined NPS_SMALL 00007 # define NPS_UTF8ISVALID_LKG static inline 00008 #else 00009 # define NPS_UTF8ISVALID_LKG 00010 #endif 00011 00012 00013 00014 #include <string.h> 00015 /* validate the string for character sequences that are illegal under the UTF-8 00016 standard. When index is non-null, returns the index of the starting byte of 00017 a malformed character. The index argument is unchanged when the string is 00018 valid. 00019 */ 00020 00021 enum nps_utf8errorno {nps_utf8valid = 0,nps_utf8missingCont=1, nps_utf8overLong=2, 00022 nps_utf8outOfRange=3}; 00023 00024 NPS_UTF8ISVALID_LKG const char *const nps_utf8errorStr(int errno); 00025 00026 NPS_UTF8ISVALID_LKG int nps_utf8nextChar(const unsigned char *result, const unsigned char *const s); 00027 00028 00029 #endif