線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:3658
推到 Plurk!
推到 Facebook!

unicode轉換FUNCTION~

 
huwk
資深會員


發表:26
回覆:340
積分:323
註冊:2002-04-03

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-06-22 23:00:28 IP:211.76.xxx.xxx 未訂閱
作者 Alfred Li  網頁:http://alf-li.tripod.com/c_index.html 經作者同意後登出 內容為詢問作者於.ConvertZ 中文內碼轉換器(免費軟體) 軟件中使用的一些轉換FUNCTION
 
function Big5ToUnicode(const Ws: string;   Page:Word):widestring;
var  IL,OL: Integer;
begin  
  IL :=Length(WS);  
  OL :=MultiByteToWideChar(CodePage,0, Pchar(ws),IL,nil,0);
  SetLength(Result,OL);  
  MultiByteToWideChar(CodePage,0,  Pchar(ws),IL,
                      pwidechar(Result),OL);
end;     // ANSI 轉 Unicode
function StringToWideString(const S: string; CodePage: Word): WideString;
var
  InputLength, OutputLength: Integer;
begin
  InputLength := Length(S);
  OutputLength := MultiByteToWideChar(CodePage, 0, PChar(S), InputLength, nil, 0);
  SetLength(Result, OutputLength);
  MultiByteToWideChar(CodePage, 0, PChar(S), InputLength, PWideChar(Result), OutputLength);
end;    //Unicode 轉 ANSI
function WideStringToString(const WS: WideString; CodePage: Word): string;
var
  InputLength, OutputLength: Integer;
begin
  InputLength := Length(WS);
  OutputLength := WideCharToMultiByte(CodePage, 0, PWideChar(WS), InputLength, nil, 0, nil, nil);
  SetLength(Result, OutputLength);
  WideCharToMultiByte(CodePage, 0, PWideChar(WS), InputLength, PChar(Result), OutputLength, nil, nil);
end;    
------
熊的學習 http://huwk.blogspot.com
yanik
一般會員


發表:0
回覆:1
積分:0
註冊:2003-05-28

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-06-23 14:23:53 IP:61.64.xxx.xxx 未訂閱
那我用D5 寫的程式 在2000 中字有些沒有辦法正常顯示,可用這辦法解決嗎??
系統時間:2024-06-28 22:52:17
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!