【发布时间】:2015-01-28 12:06:58
【问题描述】:
我正在编写一个多语言 WebBroker 应用程序(用于 Apache 2.2),它显示来自 oracle 数据库的 unicode 编码数据。在用 Delphi XE7 编写的测试程序中,具有相同数据感知组件(Devart 的 ODAC)的相同数据可以正确显示。 我的问题出现在 WebBroker 中,当我使用 PageProducer 为响应准备内容时,我遇到了奇怪的行为 当我在操作中使用以下代码时:
Response.ContentType := 'text/html; charset=UTF-8';
PageProducer1.HTMLFile:= htmltemplate
Response.Content :=
PageProducer1.Content+
'Label 1 ='+Label1fromDB+
' Label 2='+Label2fromDB+
'</body></html>';
Response.SendResponse;
webbrowser 中的结果是所有未由 PageProducer 插入但已存在于 htmltemplate 文件中的非拉丁字符(已声明为 utf-8 with )被其他不正确的字符替换,文本由 PageProducer 插入并从数据库中检索也未正确显示,但添加到内容响应中的额外标签 Label1fromDB 和 Label2fromDB 正确显示,如上面的代码所示,它们也具有与 htmltemplate 中相同的字符。
现在,当我省略声明时
Response.ContentType := 'text/html; charset=UTF-8'
html模板的内容显示正确,但所有其他文本,由PageProducer填充的文本以及Label1fromDB和Label2fromDB两个标签不正确
您能否帮我确定问题出在哪里以及我做了什么才能通过网络代理提供 unicode 多语言内容?
【问题讨论】:
标签: delphi unicode delphi-xe7