【发布时间】:2011-09-26 01:02:16
【问题描述】:
正如问题中提到的,我正在尝试使用 PHP 生成 XML 输出(用于 iPhone 应用程序),它正在从 MySQL 的文本字段中读取数据。
只要字段中有水平省略号字符... XML 生成不正确。
我已经尝试了几种方法来逃避它,如下所示,但似乎没有一种工作......
$row['detail'] = str_replace("&", "&", $row['detail']);
$row['detail'] = str_replace("…", "…", $row['detail']); //<-- prob is here
$row['detail'] = str_replace("<", "<", $row['detail']);
$row['detail'] = str_replace("\'", "'", $row['detail']);
$row['detail'] = str_replace(">", ">", $row['detail']);
$row['detail'] = str_replace("\"", """, $row['detail']);
我基本上有2个问题,
如何处理水平省略号字符?
还有更多这样的字符会导致这样的问题吗?对此列表及其解决方案的任何引用都会很棒!
谢谢
【问题讨论】:
-
当您使用省略号字符时究竟会发生什么?这很可能是编码问题。解决这个问题比创建解决方法要好得多
-
Pekka++ # 正确指定您的编码将产生比使用实体更小、更易读的结果。