开发者

Converting special characters to utf-8 in googleVis charts

In this related question an html (or php) file is produced and a googleVis chart can then be loaded into a joomla (for example) article, using something like that

{source}
<?php
  include("tmp.php");
?>
{/source}

The column name with the subject to be analysed must be passed to the gvisMotionChart's idvar property. In my case this column includes values in greek and they appear as squares on the chart. I thought I could use iconv to convert those strings to utf-8 character encoding. However, I hav开发者_JAVA技巧en't been able to use it successfully.

Could you help me have those labels shown properly?

EDIT

I found out that if I replace the strings including greek characters (the double quotes included) as follows, then it works

Replace

"greekcharacters"

with

<?php echo '"' . iconv('greek','utf-8','greekcharacters') . '"'; ?>

How can I do this globally, within R?


I think I have found it. Instead of

cat(M$html$chart, file="tmp.php")

use

cat(M$html$chart, file = (con <- file("tmp.php", "w", encoding="UTF-8"))); close(con)

I found it at the end of the connections help file

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜