0

我正在使用 php/MySQL 驱动的 JSON 事件源。我还尝试在事件的标题中使用希腊语 html 实体(即 &Gamma-带分号)。因为 FullCalendar 不会让我看到 firebug 中的所有进程,所以我看不到到底发生了什么,但它不会渲染 Γ 等。我已经尝试了我在 php json_encode 中能想到的所有组合,即实际的 MySQL db 字段结果。fullCalendar 在其网站上推荐的 QTip 实际上在提示渲染中正确渲染了它。我很茫然,因为如果可能的话,这是我真正希望在应用程序中使用的东西。任何帮助将不胜感激。


轻微更新

我终于发现 JSON 被操纵以使 & 本身变成 &';' 不管我做什么; 所以这方面的任何相关信息也可以派上用场。谢谢

4

3 回答 3

3

I ran into a similar issue with ampersands (&) and html tags. It looks like the plugin converts everything to html entities. Because of this, html tags and entities actually show up. For example, &amp; gets converted to &amp;amp; and appears as &amp; instead of & and <br /> gets converted to &lt;br /&gt; and appears as <br /> instead of a break. You could modify htmlEscape() (ln 3368 of version 1.4.5) to just return s. You could also setup an eventRender callback as follows:

eventRender: function(event, element) {
  $('.fc-event-title', element).html(event.content);
}

While a little redundant, these ensures that it won't be broken for you in future versions.

I have filed an issue with the maintainer at http://code.google.com/p/fullcalendar/issues/detail?id=400.

于 2010-03-15T20:49:59.153 回答
0

尝试在任何地方设置 utf8 编码并使用所需的符号而不是 html 代码。并将php文件保存为不带BOM的UTF-8,可以使用notepad++编辑器。

您可以首先检查 php 页面中数据库的输出,并使用回显数据库查询结果。如果它给出错误的编码,请尝试使用 phpmyadmin 或类似工具设置 unicode utf8 或您希望的编码。让我们说utf8。

你的php版本是多少?还尝试检查您是否可以使用 mysql_set_charset() 函数,如果您可以尝试检测 php/mysql 连接中的默认字符集:

  <?php
     $dbhandle = mysql_connect('localhost','user1','pass1',TRUE);
     $charset = mysql_client_encoding($dbhandle);
     echo "The current character set is: $charset\n";
  ?>

是utf8吗?如果不尝试这样设置:

      $charset = mysql_client_encoding($dbhandle);
      echo "The current character set is: $charset\n";

      mysql_set_charset('utf8',$dbhandle);
      echo "The last current character set is: $charset\n";
  ?>

并将所有 HTML 文件设置为 utf8 编码。

于 2010-04-18T19:52:15.477 回答
0

在将事件标题html_entity_decode()添加到 json 数组之前,我将其包装起来:

$title = html_entity_decode( $title, ENT_QUOTES, "UTF-8" );
于 2014-09-04T00:59:14.233 回答