简体   繁体   English

如何通过php制作xml时处理融合图中的特殊字符

[英]how to deal with special characters in fusion charts while making xml through php

I am using fusion charts, and getting xml of fusion charts through ajax. 我正在使用融合图,并通过ajax获取融合图的xml。 On server side I am using php to make xml. 在服务器端,我使用php来制作xml。 I am using htmlentities function like this 我正在使用这样的htmlentities函数

$name = htmlentities($name, ENT_QUOTES , 'UTF-8'); 

to encode special characters and getting this kind of xml 编码特殊字符并获取这种xml

<dataset seriesName='le fran&ccedil;ais'> 

for le français. 对于法国人。

But is does not show in fusion chart. 但在融合图中未显示。 Plz tell me the correct way to do it. 请告诉我正确的方法。

I just made a PHP file with the lines below and save it as an ANSI encoded file: 我只是用以下几行制作了一个PHP文件,并将其另存为ANSI编码文件:

$name = 'le français';
$name = htmlentities($name, ENT_QUOTES);
echo $name;

This just gave me the result you were expecting: 这只是给了我您期望的结果:

le fran&ccedil;ais

Seems the special charcter just gets ignored when using UTF-8 as encoding: 使用UTF-8作为编码时,似乎只是忽略了特殊字符:

htmlentities($name, ENT_QUOTES, 'UTF-8');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM