From 95646cdf94c98bb3f953cca35b830f558b3655fa Mon Sep 17 00:00:00 2001 From: Werner Joss <36265757+wernerjoss@users.noreply.github.com> Date: Thu, 1 Sep 2022 17:43:02 +0200 Subject: [PATCH] fix issue #53, google-ics german Umlaut not converted --- CHANGELOG.md | 6 ++++++ assets/calendar.js | 13 +++++++++++++ blueprints.yaml | 2 +- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09e51f27..4046b3fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# v0.3.3 +## 09/01/2022 + +1. [](#bugfix) + * fix issue #53, google-ics german Umlaut not converted + # v0.3.2 ## 04/15/2022 diff --git a/assets/calendar.js b/assets/calendar.js index 198013ca..d0e55912 100644 --- a/assets/calendar.js +++ b/assets/calendar.js @@ -236,6 +236,7 @@ function whenJqReady() { url: calendarUrl, //dataType: "json", //no need. if you use crossOrigin, the dataType will be override with "json" //charset: 'ISO-8859-1', //use it to define the charset of the target url + //contentType: "application/json; charset=ISO-8859-1", // test encoding, geht nicht 31.08.22 context: {}, success: function(data) { // alert(data); @@ -254,6 +255,13 @@ function whenJqReady() { var fcevents = {}; // fcevents["tzid"] = icsTimezone; var entry = item.getFirstPropertyValue("summary"); + // console.log('Entry: ', entry); + // fix badly encoded Text from remote google calendars 01.09.22 + try { // see https://stackoverflow.com/questions/5396560/how-do-i-convert-special-utf-8-chars-to-their-iso-8859-1-equivalent-using-javasc + entry = decodeURIComponent(escape(entry)); + } catch(e) { + entry = entry; + } if (entry !== null) fcevents["title"] = entry; var entry = item.getFirstPropertyValue("location"); if (entry !== null) fcevents["location"] = entry; @@ -284,6 +292,11 @@ function whenJqReady() { fcevents["allDay"] = true; // default value -> span .fc-time in grid is NOT created if (duration < 86400000) fcevents["allDay"] = false; // duration less than 1 day: allDay = false var entry = item.getFirstPropertyValue("description"); // add description 22.06.20 + try { // see https://stackoverflow.com/questions/5396560/how-do-i-convert-special-utf-8-chars-to-their-iso-8859-1-equivalent-using-javasc + entry = decodeURIComponent(escape(entry)); + } catch(e) { + entry = entry; + } if (entry !== null) fcevents["description"] = entry; var entry = item.getFirstPropertyValue("color"); // add color from ics if (entry !== null) fcevents["color"] = entry; diff --git a/blueprints.yaml b/blueprints.yaml index d0366d10..7baebbef 100644 --- a/blueprints.yaml +++ b/blueprints.yaml @@ -1,5 +1,5 @@ name: FullCalendar -version: 0.3.2 +version: 0.3.3 description: show Calendar Widget from ICS File(s), based on fullcalendar.io icon: calendar author: