如题
解决方案 »
- 问个基础问题vb中rs.open和rs.Execute语句区别?
- 如何用ADO建一个MDB数据库
- 如何把DBF的某个字段的第一个记录的值赋予一个变量呀?
- MMControl控件播放视频文件How to 改变视图大小
- !!!!!获取各大下载站的数据库!!!!!见者有分。
- 菜鸟问题,ADO怎样另存为一个表呢?
- 怎样才能使客户端能浏览服务端的文件目录?
- 奇怪啊,我的ODBC怎么由中文变成了英文的?而且以前的Windows认证都不行了?!!急!!在线等!!
- 如何使编的程序在2000server下隐身
- 大出血,高分请教Webbrowser控件问题:如何替换指定文本和滚动文本框的内容!!!!!(UP者有分)
- 如何修改指定的内存并锁定?
- 请问错在哪???
搜索关键字 UTF 8 有很多的
procedure unicode2gb(const unicodestr:string; var GbStr:String);
var
SourceLength:integer;
DoneLength:integer;
AscNo:integer;
Byte1,Byte2,Byte3:integer;
begin
GbStr:='';
if Trim(unicodestr)='' then exit;SourceLength:=Length(UnicodeStr);
DoneLength:=1;
repeat
AscNo:=ord(UnicodeStr[DoneLength]);
case (AscNo and $E0) of
$E0:begin
Byte1:=(AscNo and $0f) shl 12;
Inc(DoneLength);
if DoneLength>SourceLength then break;
AscNo:=ord(UnicodeStr[DoneLength]);
Byte2:=(AscNo and $3f) shl 6;
Inc(DoneLength);
if DoneLength>SourceLength then break;
AscNo:=ord(UnicodeStr[DoneLength]);
Byte3:=AscNo and $3f;
end;
$C0:begin
Byte1:=(AscNo and $1f) shl 6;
Inc(DoneLength);
if DoneLength>SourceLength then break;
AscNo:=ord(UnicodeStr[DoneLength]);
Byte2:=(AscNo and $3f);
Byte3:=0;
end;
0..$bf:begin
Byte1:=AscNo;
Byte2:=0;
Byte3:=0;
end;
end;//case;
GbStr:=GBStr+widechar(Byte1+Byte2+Byte3);
Inc(DoneLength);
if DoneLength>SourceLength then break;
until DoneLength>=SourceLength;
end;