odtphp 段中的编码问题

发布于 2024-12-14 14:59:20 字数 356 浏览 3 评论 0原文

我正在使用 odtphp 将文本从数据库写入 ODT 文档表,使用此 http ://www.odtphp.com/index.php?i=tutorials&p=tutorial6 示例。在生成的 ODT 中,某些国际字符编码错误(或未编码?)。使用 setVar() 函数设置的其他值(不在段中)也存在类似问题,但已使用 解决

$odf->setVars($k, $v, true, 'UTF-8');

看起来没有针对段值的其他设置。

I'm writing text from database to ODT document table using odtphp, using this http://www.odtphp.com/index.php?i=tutorials&p=tutorial6 example. In generated ODT some international characters are encoded wrong (or not encoded?). There was similar problem with other values, not in segments, that were set using setVar() function, but it was solved using

$odf->setVars($k, $v, true, 'UTF-8');

Looks like there's no additional settings for segment values.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情场扛把子 2024-12-21 14:59:20

看起来段中的所有文本都再次编码为 UTF-8,即使文本已经采用 UTF-8。
目前,我通过用以下代码替换 odtphp 中 Segment.php 中的第 203 行解决了这个问题:

return $this->setVars($meth, $args[0], false, 'UTF-8');

Looks like that all text in segments were encoded to UTF-8 again, even if text has already been in UTF-8.
Currently I solved this issue by replacing line 203 in Segment.php from odtphp with following code:

return $this->setVars($meth, $args[0], false, 'UTF-8');
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文