简体   繁体   English

FullCalendar月视图上的标题未正确显示

[英]Title on FullCalendar month view not displaying properly

Please check out the web page I am making at https://preview.c9.io/tomheaps/enharmonic/Website/enharmonic_calendar.html?_c9_id=livepreview2&_c9_host=https://ide.c9.io which has an embedded google calendar, styled using the jquery plugin FullCalendar. 请查看我正在制作的网页https://preview.c9.io/tomheaps/enharmonic/Website/enharmonic_calendar.html?_c9_id=livepreview2&_c9_host=https://ide.c9.io ,其中包含嵌入式谷歌日历,使用jquery插件FullCalendar设计样式。

As you will see, when you click on month view, the title is not displaying properly with some strange characters between the two dates and shows '1st — 7th June 2015' instead of '1st - 7th June 2015' for example. 正如您将看到的,当您单击月视图时,标题显示不正确,两个日期之间有一些奇怪的字符,并显示“2015年6月1日”,而不是“2015年6月1日 - 7月7日”。

I am not sure if this is happening because I am using Open Sans as the font for this title and it doesn't contain the glyph that is inserted automatically by the javascript? 我不确定这是否发生,因为我使用Open Sans作为此标题的字体,它不包含由javascript自动插入的字形?

Can anyone think of a workaround for this that allows me to still use Open Sans? 任何人都可以想到一个允许我仍然使用Open Sans的解决方法吗?

Tom, make sure that you are serving your HTML as UTF-8: header("Content-Type: text/html; charset=utf-8"); Tom,确保您将HTML作为UTF-8:标题提供(“Content-Type:text / html; charset = utf-8”);

Include the tag below right after the html tag. 在html标记后面包含下面的标记。

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

I had the same issue I was seeing â instead of —. 我遇到了同样的问题 - 而不是 - 。 It is a codification problem. 这是一个编纂问题。

I solved it easily: 我很容易解决了:

Observation: 观察:

  • In fullcalendar v.3.9.0, the titleRangeSeparator from the fullcalendar.js is ' \– ' which is correct. 在fullcalendar v.3.9.0中, fullcalendar.js中的titleRangeSeparator是' \\ u2013 ',这是正确的。
  • However, fullcalendar.min.js the titleRangeSeparator is . 但是,titleRangeSeparator的fullcalendar.min.js-

Solution: 解:

  • I changed manually the value of titleRangeSeparator from the file fullcalendar.min.js from' - ' to ' \– ' --> problem fixed. 我将titleRangeSeparator的值从文件fullcalendar.min.js手动更改为' - '到' \\ u2013 ' - >问题已修复。

I had this issue too, while developing all was fine, when deployed got this problem. 我也遇到过这个问题,而开发一切都很好,部署时遇到了这个问题。

As @PolFernandez pointed out in his answer (thank you man) , the problem is that minified version of fullcalendar library had different notation for separator. 正如@PolFernandez 在他的回答中指出的那样 (谢谢你),问题是fullcalendar库的缩小版本对于分隔符有不同的表示法。

If you don't want to modify original fullcalendar.min.js you can simply set the separator in calendar initialization: 如果您不想修改原始fullcalendar.min.js,只需在日历初始化中设置分隔符:

$('#calendar').fullCalendar({
    views: {
        month: { columnHeaderFormat: 'ddd', displayEventEnd: true, eventLimit: 3 },
        week: { columnHeaderFormat: 'ddd DD', titleRangeSeparator: ' \u2013 ' },
        day: { columnHeaderFormat: 'dddd' },
    },
});

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

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