一、关于不同字符的宏定义
typedef gunichar UT_UCS4Char;
typedef guint16 UT_UCS2Char;typedef UT_UCS4Char UT_UCSChar; /* Unicode */
typedef guint32 gunichar;
typedef guint16 gunichar2;
AbiWord is now fully converted to using 32-bit Unicode internally
在Abiword内部完全转换成32-bit Unicode 表示。
二、针对UT_UCS*Char 的常用函数,参考:af\util\xp\ut_string.cpp
UT_UCS4_strcmp 比较两个字符串
UT_UCS4_strlen 取字符串的长度
UT_UCS4_strcpy 复制字符串
UT_UCS4_strcpy_char 从char到UT_UCS4Char的复制
UT_UCS4_strcpy_to_char 从UT_UCS4Char到char的复制
对UT_UCS2Char有对应的操作
三、编码转换
AP_Win32App::s_fromWinLocaleToUTF8,将本地编码转换成UTF-8
AP_Win32App::s_fromUTF8ToWinLocale,将UTF-8转换成本地编码
AP_Win32App::s_fromUCS4ToWinLocale
AP_Win32App::s_fromWinLocaleToUCS4
四、Abiword对字符类型的封装
1、UT_String,UT_String, a simple wrapper for zero terminated 'char' strings.对char类型的封装。
// 8-bit string// String is built of 8-bit units (bytes)// Encoding could be any single-byte or multi-byte encoding2、UT_UTF8String,UT_UTF8String, a simple wrapper for zero terminated 'UTF-8' strings.UTF-8编码的字符封装
// UTF-8 string: encoding is *always* UTF-83、UT_UCS4String,UT_UCS4String, a simple wrapper for zero terminated 'UCS4' strings.USC4字符的封装
// UCS-4 string// String is built of 32-bit units (longs)// NOTE: Ambiguity between UCS-2 and UTF-16 above makes no difference// NOTE: in the case of UCS-4 and UTF-32 since they really are// NOTE: identical
四、MSDN Generic-Text Mappings
MSDN中"Generic-Text Routine Mappings."标题下有完整的宏列表。