delphi 7版htmlEncode支持中文
来源:互联网 发布:圆弧插补算法 螺旋线 编辑:程序博客网 时间:2024/05/21 09:29
在网上找了不少htmlEncode例子,当然httpapp自带的太弱了,只有这个代码http://www.sharejs.com/codes/delphi/2264跟我的要求相近,不过对含中文的html进行编码就不对了。
现真对这个进行改进。
function MakeSafeHTMLText2(TheText: widestring): string;var Idx: Integer; // loops thru characters of TheText Ch: wideChar; // each charactor in TheTextbegin Result := ''; for Idx := 1 to Length(TheText) do begin Ch := TheText[Idx]; case Ch of '<': Result := Result + '<'; '>': Result := Result + '>'; '&': Result := Result + '&'; '"': Result := Result + '"'; else begin if (Ch < #32) or (Ch >= #127) then // Result := Result + '&#' + IntToStr(Ord(Ch)) + ';' Result := Result + '&#x' + InttoHex(Integer(ch),2) + ';' else Result := Result + Ch; end; end; end; end;
有不足的地方,欢迎指正。
- delphi 7版htmlEncode支持中文
- HtmlEncode
- HtmlEncode
- HTMLEncode
- HtmlEncode
- delphi for php 支持中文的方法
- delphi for php 支持中文的方法
- delphi for php 支持中文的方法
- delphi for php 支持中文的方法
- delphi for php 支持中文的方法
- delphi for php 支持中文的方法
- delphi for php 支持中文的方法
- delphi XE对中文变态支持!
- delphi for php 中文完全支持方法[转]
- delphi 的 pos 函数 对中文支持不好。
- Delphi二维码中文支持、分组、批量打印经验小结
- smartupload支持中文编码版
- Qt4.7支持中文显示
- 【java】IO流之切割与合并文件
- fedora17 安装后要做的事情
- 退避算法的定义
- 插入排序——直接插入排序
- 无线互联应用开发技术P2P
- delphi 7版htmlEncode支持中文
- opencv是什么
- 再谈OpenCV
- bit 1049 Relatives
- WEKA连接MySQL,Oracle,SQLServer
- 前端开发框架bootstrap
- [gpu pro]screen space soft shadows
- 数据库完整性约束
- 退避算法在android开发中的应用