Windows系統對中文生僻字支援問題的解決辦法

2021-06-28 17:15:18 字數 2920 閱讀 9103

1.windows api對gb18030-2000 的支援下列 windows api 提供對gb18030-2000 的支援。

isvalidcodepage(), getcpinfo(), multibytetowidechar() and widechartomultibyte().

具體說明如下:

1) isvalidcodepage(54936) returns true.

2) getcpinfo(54936, lpcpinfo) returns true.

3) multibytetowidechar(54936, 0, lpmultibytestr, cbmultibyte, lpwidecharstr, cchwidechar) 完成gb18030-2000 字串 lpmultibytestr 到 unicode 字串 lpwidecharstr  的轉換。

4) widechartomultibyte(54936, 0, lpwidecharstr, cchwidechar, lpmultibytestr, cbmultibyte, lpdefaultchar, lpuseddefaultchar) 完成unicode 字串 lpwidecharstr 到 gb18030-2000 字串 lpmultibytestr  的轉換。

2. gb18030 函式庫

微軟4位元組字符集編碼支援包 (ms4bsp- microsoft 4-byte character set encoding support package) 提供了六個函式,這六個函式支援多位元組編碼(多達4位元組)的字串。 這些api 是從windows 95/98/me 提供的wchar (unicode) 函式集中精選出來的。函式名與相應的ansi 和wchar(unicode) 函式完全相同,只是字尾的』a』 或』w』被』l』替代。這些函式的引數與相應的』a』版本函式的引數介面完全相同。該支援包可使基於936**頁的應用程式向gb18030 或其他4位元組編碼的轉換更加快捷。

ms4bsp 在windows xp 平台的實現是作為乙個簡單的動態連線庫 – ms4bsp.dll。 每一函式都通過呼叫multibytetowidechar() 函式將任何多位元組字串輸入引數轉換為utf-16編碼格式,然後呼叫相應的 『w』 版本的函式,返回該函式的輸出引數。該動態連線庫假設當前系統中存在相關的字型,輸入法(ime) 和登錄檔的設定資訊。

該函式集中的預設4位元組字元編碼為54936 (gb18030-2000). 將來版本的ms4bl 可能支援其他4位元組編碼。

介面清單:

bool exttextoutl(

hdc hdc, // handle to dc

int x, // x-coordinate of reference point

int y, // y-coordinate of reference point

uint fuoptions, // text-output options

const rect* lprc, // optional dimensions

lpcstr lpstring, // string

uint cbcount, // number of characters in string

const int* lpdx // array of spacing values

);bool gettextextentexpointl(

hdc hdc, // handle to dc

lpcstr lpszstr, // character string

int cchstring, // number of characters

int nmaxextent, // maximum width of formatted string

lpint lpnfit, // maximum number of characters

lpint alpdx, // array of partial string widths

lpsize lpsize // string dimensions

);bool gettextextentpoint32l(

hdc hdc, // handle to dc

lpcstr lpstring, // text string

int cbstring, // characters in string

lpsize lpsize // string size

);int messageboxl(

hwnd hwnd, // handle to owner window

lpcstr lptext, // text in message box

lpcstr lpcaption, // message box title

uint utype // message box style

);int messageboxexl(

hwnd hwnd, // handle to owner window

lpcstr lptext, // text in message box

lpcstr lpcaption, // message box title

uint utype, // message box style

word wlanguageid // language identifier

);bool textoutl(

hdc hdc, // handle to dc

int nxstart, // x-coordinate of starting position

int nystart, // y-coordinate of starting position

lpcstr lpstring, // character string

int cbstring // number of characters

);

TCPDF中文生僻字解決方案

根據網上方法中文亂碼解決 但是出現生僻字還是亂碼 建立個新檔案 如下 require once tcpdf.php pdf new tcpdf fontname tcpdf fonts addttffont k path fonts.wrvistayh.ttf truetypeunicode 32 ...

windows系統中檔案命名不能含有哪些字元

在windows系統當中的檔案命名,有些特殊字元是不能存在,下面我們來看一下哪些字元不能存在。檔名稱中不能包含 一共9個特殊字元 資料夾名稱中特殊字元校驗與檔名稱校驗相同 那麼為什麼不能在命名中存在這些特殊字元呢?因為 這些字元,在windows中都有特定含義的,如果做為檔名就會引起歧義。比如 是作...

輸入可以相互翻譯的英文和對應中文,生成中英譯文

1程式前提 輸入可以相互翻譯的英文和對應中文,假設句子為逐句翻譯,結尾標點符號 句號,嘆號,問號 句句對應,可以生成中英譯文 無論如果,必須具有規律性 3備註 注 中文字元為兩個位元組,ascll碼一般為兩個負數 如以下中文標點符號 3程式設計思路 思路 假設句子為逐句翻譯,結尾標點符號 句號,嘆號...