FullCalendar/JSON event feed problem
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.开发者_JAVA百科 Thx
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 &
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.
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.
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" );
精彩评论