DELPHI盒子
!实时搜索: 盒子论坛 | 注册用户 | 修改信息 | 退出
检举帖 | 全文检索 | 关闭广告 | 捐赠
技术论坛
 用户名
 密  码
自动登陆(30天有效)
忘了密码
≡技术区≡
DELPHI技术
lazarus/fpc/Free Pascal
移动应用开发
Web应用开发
数据库专区
报表专区
网络通讯
开源项目
论坛精华贴
≡发布区≡
发布代码
发布控件
文档资料
经典工具
≡事务区≡
网站意见
盒子之家
招聘应聘
信息交换
论坛信息
最新加入: cdk19821
今日帖子: 31
在线用户: 6
导航: 论坛 -> DELPHI技术 斑竹:liumazi,sephil  
作者:
男 hujiacheng (旺财) ★☆☆☆☆ -
普通会员
2011/9/5 16:48:33
标题:
关于delphi XE  ISAPI 的疑问 浏览:1579
加入我的收藏
楼主: 在开发WEB的时候发现 Response.Content 默认编码是GB18030 是系统环境导致默认设置是GB18030  吗? 如何改成UTF8 呢?
目前用了个苯办法
function StrToHex(str: string; AEncoding: TEncoding): string;
var
  ss: TStringStream;
  i: Integer;
begin
  Result := '';
  ss := TStringStream.Create(str, AEncoding);
  Result := AEncoding.GetString(ss.Bytes);
  ss.SaveToFile('123.txt');
{  for i := 0 to ss.Size - 1 do
    Result := Result + Format('%.2x ', [ss.Bytes[i]]);  }
  ss.Free;
end;
来重新编码。。
StrToHex(Response.Content,TEncoding.Default);

有人来讨论嘛?
----------------------------------------------
免费的FTPhttps://download-installer.cdn.mozilla.net/pub/firefox/releases/43.0/win64/zh-CN/https://cc.embarcadero.com/Author/575019>http://delphi-z.ruhttps://download-installer.cdn.mozilla.net/pub/firefox/releases/43.0/win64/zh-CN/https://cc.embarcadero.com/Author/575019>http://delphi.icm.edu.pl/ftp/https://download-installer.cdn.mozilla.net/pub/firefox/releases/43.0/win64/zh-CN/https://cc.embarcadero.com/Author/575019>http://delphi-z.ruhttps://download-installer.cdn.mozilla.net/pub/firefox/releases/43.0/win64/zh-CN/https://cc.embarcadero.com/Author/575019
作者:
男 2010632 (嘎嘎) ★☆☆☆☆ -
普通会员
2011/9/5 17:10:19
1楼: 返回数据之前重新指定下Reponse的字符编码
----------------------------------------------
!!!!!!!
作者:
男 hujiacheng ( 旺财) ★☆☆☆☆ -
普通会员
2011/9/5 17:35:18
2楼: 不改 原有单元 直接使用
function StrToHex(str: string; AEncoding: TEncoding): string;

StrToHex(Response.Content,TEncoding.UTF8);
这样。。目前就这样的。按此在新窗口浏览图片
这样的话 每次 来访问先处理然后给数据。。看样子还是得改单元来实现?。
----------------------------------------------
免费的FTPhttps://download-installer.cdn.mozilla.net/pub/firefox/releases/43.0/win64/zh-CN/https://cc.embarcadero.com/Author/575019>http://delphi-z.ruhttps://download-installer.cdn.mozilla.net/pub/firefox/releases/43.0/win64/zh-CN/https://cc.embarcadero.com/Author/575019>http://delphi.icm.edu.pl/ftp/https://download-installer.cdn.mozilla.net/pub/firefox/releases/43.0/win64/zh-CN/https://cc.embarcadero.com/Author/575019>http://delphi-z.ruhttps://download-installer.cdn.mozilla.net/pub/firefox/releases/43.0/win64/zh-CN/https://cc.embarcadero.com/Author/575019
信息
登陆以后才能回复
Copyright © 2CCC.Com 盒子论坛 v3.0.1 版权所有 页面执行54.6875毫秒 RSS