Abiword中字符操作
一、關于不同字符的宏定義
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 encoding
////////////////////////////////////////////////////////////////////////
2、UT_UTF8String,UT_UTF8String, a simple wrapper for zero terminated 'UTF-8' strings.UTF-8編碼的字符封裝
////////////////////////////////////////////////////////////////////////
//? UTF-8 string: encoding is *always* UTF-8
////////////////////////////////////////////////////////////////////////
3、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."標題下有完整的宏列表。
更多文章、技術交流、商務合作、聯系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
