FullCalendar/JSON 事件源问题

发布于 2024-08-23 16:50:13 字数 377 浏览 3 评论 0原文

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


轻微更新

我终于发现 JSON 被操纵以使 &本身进入 &';'无论我做什么;因此,任何相关信息也可能派上用场。谢谢

I am using a php/MySQL driven event feed to JSON. I am also trying to use greek html entities (i.e. &Gamma-with the semicolon) in the title for the event. Because FullCalendar will not let me see all the processies in firebug I can't see exactly what is going on but it will not render the Γ, etc. I have tried all the combinations I can think of in the php json_encode, the actual MySQL db field result. QTip which fullCalendar recommended on their site actually renders it correctly in the tip rendering. I am at a loss because this is something I really wish to use in the app if at all possible. Any help would be greatly appreciated.


Slight Update

I finally found that the JSON is being manipulated to make the & itself into &';' no matter what I do; so any relevant info on this could come in handy also. Thx

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

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

发布评论

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

评论(3

你是我的挚爱i 2024-08-30 16:50:13

我在与号 (&) 和 html 标签方面遇到了类似的问题。看起来该插件将所有内容转换为 html 实体。因此,html 标签和实体实际上会显示出来。例如,& 转换为 & 并显示为 & 而不是 & ;
转换为
并显示为
;
而不是休息。您可以修改 htmlEscape() (版本 1.4.5 的 ln 3368)以仅返回 s。您还可以按如下方式设置 eventRender 回调:

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

虽然有点多余,但这些可以确保它在未来版本中不会被破坏。

我已向 http://code.google 的维护者提交了问题.com/p/fullcalendar/issues/detail?id=400

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, & gets converted to &amp; and appears as & instead of & and <br /> gets converted to <br /> 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.

寄风 2024-08-30 16:50:13

尝试在所有地方设置 utf8 编码并使用所需的符号而不是 html 代码。
并保存php文件,为UTF-8无BOM,可以使用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 编码。

Try to set utf8 encoding everywhere and use needed symbols instead of html code.
And save the php file, as UTF-8 without BOM, you can use notepad++ editor.

You can first check output from database within php page with echo-ing database query result. If it gives wrong encoding try to set unicode utf8 or encoding you wish, with phpmyadmin or similar tool. Lets say utf8.

What is your php version?
Also try to check if you can use mysql_set_charset() function, if you can then try to detect wich charset is default in you php/mysql connection with:

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

Is it utf8? If not try to set it like this:

      $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";
  ?>

and also set all your HTML files to utf8 encoding.

↙厌世 2024-08-30 16:50:13

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

$title = html_entity_decode( $title, ENT_QUOTES, "UTF-8" );

I wrapped the event title in html_entity_decode() before adding it to the json array:

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