gpt4 book ai didi

xml - Coldfusion XMLFormat() 不转换所有字符

转载 作者:数据小太阳 更新时间:2023-10-29 02:16:55 25 4
gpt4 key购买 nike

我正在使用 XMLFormat() 为 XML 文档编码一些文本。但是,当我去阅读我创建的 XML 文件时,出现了无效字符错误。为什么 XMLFormat() 没有正确编码所有字符?

我正在运行 CF8。

最佳答案

您确定以正确的编码输出文件吗?你不能只是做

<cffile action="write" file="foo.xml" output="#xml#" />

因为结果很可能与您的 XML 所在的字符集不同。除非另有说明(通过编码声明),否则 XML 文件被视为 UTF-8,您应该这样做:

<cffile action="write" file="foo.xml" output="#xml#" charset="utf-8" />
<!--- and --->
<cffile action="read" file="foo.xml" variable="xml" charset="utf-8" />

关于xml - Coldfusion XMLFormat() 不转换所有字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1689900/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com