1,一般繁体环境的操作系统用的编码是不是BIG5码?
2,一般简体环境的操作系统用的编码是不是GB码?
3,这两种编码和Unicode有什么关系?
4,怎样将数据进行BIG5和GB的转换?
5,怎样通过程序实现操作系统简繁体的转换?
感激不尽!
2,一般简体环境的操作系统用的编码是不是GB码?
3,这两种编码和Unicode有什么关系?
4,怎样将数据进行BIG5和GB的转换?
5,怎样通过程序实现操作系统简繁体的转换?
感激不尽!
解决方案 »
- 一个结构指针问题
- 问一个简单的问题,快进来接分,急,在线等,有答案马上结!
- 小弟问个全局变量的基础问题-绝不欠分和无满意结帖。
- 在richedit中输入特殊字符♥,如何将这个richedit的text付值给另一个richedit?(在线)
- 如何解决clientdataset“Record not found or changed by another user”问题?
- 鼠标移动时如何显示一条竖线并使竖线不重复
- treeview 如何按stateindex排序?
- 怎样取得局域网内所有机器的名称和IP地址呢?
- 如何把DLL中的窗体嵌入到主程序的窗体中?
- richedit1.lines.loadfromfile()为何只能装入文本30万行?
- 请求帮助
- [Help]子父窗口返回值问题
========有一个内码转换软件ConvLite.exe,但只可以转换文本,excel,word之类的文件。
5,怎样通过程序实现操作系统简繁体的转换?
=============
你以为这样容易啊?那微软还开发繁、简两套操作系统干吗?问问题别老异想天开。呵呵
Re:一般都是的2,一般简体环境的操作系统用的编码是不是GB码?
Re: 一般都是的。3,这两种编码和Unicode有什么关系?
Re: Unicode是一种可以几乎包括所有国家字符的编码,也即全世界所有的字都有唯一的一个Unicode编码,由两个字节表示。Big5和GB是一种多字节编码,由两个字节组成,第一个字节大于127,以与Ansi字符区分,但Big5和GB有可能是编码一样,但表示的字节不一样。
可以将Big5和GB变成Unicode码,只要找到对应的字符集对应的代码页,再用一个API(一时忘了)进行转换
874 Thai
932 Japan
936 Chinese (PRC, Singapore)
949 Korean
950 Chinese (Taiwan, Hong Kong)
1200 Unicode (BMP of ISO 10646)
1250 Windows 3.1 Eastern European
1251 Windows 3.1 Cyrillic
1252 Windows 3.1 Latin 1 (US, Western Europe)
1253 Windows 3.1 Greek
1254 Windows 3.1 Turkish
1255 Hebrew
1256 Arabic
1257 Baltic4,怎样将数据进行BIG5和GB的转换?
Re:有程序可以看,去DelphiBox上找一下。5,怎样通过程序实现操作系统简繁体的转换?
这个。
int MultiByteToWideChar( UINT CodePage, // code page
DWORD dwFlags, // character-type options
LPCSTR lpMultiByteStr, // address of string to map
int cchMultiByte, // number of characters in string
LPWSTR lpWideCharStr, // address of wide-character buffer
int cchWideChar // size of buffer
);
2 简体中文环境一般编码都是GB
3 UNICODE,GB,Big5是三种不同的编码,但是UNICODE可以支持简体和繁体中文
4 下面的程序来自大富翁论坛// GB2312/BIG5 convert unit for Delphi 3
// ver 1.01
// By Tom Lee 1997/9/5
// E-Mail Address : [email protected]
// It is Freeware ! unit CVCode; interface
function GBtoBIG5(value: string): string;
function BIG5toGB(value: string): string; implementation var
BIG5Order: array[0..14757] of Word;
GBOrder : array[0..8177] of Word; function GBOffset(value: string): integer;
begin
if length(value) >= 2 then
Result := (Ord(value[1]) - 161) * 94 + (Ord(value[2]) - 161)
else
Result := -1;
end; function BIG5Offset(value: string): integer;
begin
Result := -1;
if length(value) >= 2 then
begin
if (Ord(value[2]) >= 64) and (Ord(value[2]) <= 126) then
Result := (Ord(value[1]) - 161) * 157 + (Ord(value[2]) - 64);
if (Ord(value[2]) >= 161) and (Ord(value[2]) <= 254) then
Result := (Ord(value[1]) - 161) * 157 + 63 + (Ord(value[2]) - 161);
end
end; function WordToString(value: Word): string;
begin
Result := Chr(Hi(value)) + Chr(Lo(Value));
end; function isBIG5(value: string): Boolean;
begin
if (length(value)>=2) then
begin
if (value[1] < #161) then
Result := false
else
if ((value[2] >= #64) and (value[2] <= #126)) or ((value[2] >= #161) and (value[2] <= #254)) then
Result := true
else
Result := false
end
else
Result := false
end; function isGB(value: string): Boolean;
begin
if (length(value)>=2) then
begin
if (value[1] <= #161) and (value[1] >= #247) then
Result := false
else
if (value[2] <= #161) and (value[2] >= #254) then
Result := false
else
Result := true
end
else
Result := true;
end; function GBtoBIG5(value: string): string;
var
leng, idx : integer;
tmpStr : string[2];
Offset : integer;
output : string;
begin
output := '';
leng := length(value);
idx := 1;
while idx <= leng do
begin
tmpStr := value[idx]+ value[idx + 1];
if isGB(tmpStr) then
begin
offset:=GBOffset(tmpStr);
if (offset >= 0) and (offset <= 8177) then
begin
output := output + WordToString(GBOrder[offset]);
inc(idx);
end
else
output := output + value[idx] ;
end
else
output := output + value[idx] ; inc(idx, 1);
end;
Result := output;
end; function BIG5toGB(value: string): string;
var
leng, idx : integer;
tmpStr : string[2];
output : string;
offset : integer;
begin
output := '';
leng := length(value);
idx := 1;
while idx <= leng do
begin
tmpStr := value[idx]+ value[idx + 1];
if isBIG5(tmpStr) then
begin
offset:=BIG5Offset(tmpStr);
if (offset >= 0) and (offset <= 14757) then
begin
output := output + WordToString(BIG5Order[offset]);
inc(idx);
end
else
output := output + value[idx];
end
else
output := output + value[idx]; inc(idx);
end;
Result := output;
end; initialization BIG5Order[0] := $2020;
BIG5Order[1] := $A3AC;
BIG5Order[2] := $A1A2;
BIG5Order[3] := $A1A3;
BIG5Order[4] := $2020;
BIG5Order[5] := $A1A4;
..
..
..
..
BIG5Order[14753] := $2020;
BIG5Order[14754] := $2020;
BIG5Order[14755] := $2020;
BIG5Order[14756] := $2020;
BIG5Order[14757] := $2020;
GBOrder[0] := $2020;
GBOrder[1] := $A142;
GBOrder[2] := $A143;
GBOrder[3] := $A145;
GBOrder[4] := $A1C2;
GBOrder[5] := $A3BE;
..
..
..
GBOrder[8175] := $ECB8;
GBOrder[8176] := $C24D;
GBOrder[8177] := $2020;
GBOrder[8177] := $2020;
end.5 好像不行,但是操作系统支持部分文件格式的繁简转换