craigk5n / webcalendar

WebCalendar is a PHP application used to maintain a calendar for a single user or an intranet group of users. It can also be configured as an event calendar.
http://www.k5n.us/webcalendar.php
GNU General Public License v2.0
153 stars 75 forks source link

Calendar entries and descriptions containing umlauts are not shown (WebCalendar 1.2.9) #39

Open codifex opened 7 years ago

codifex commented 7 years ago

I updated WebCalendar 1.2.7 to 1.2.9 and switched from PHP 5.3 to PHP 5.6. My WebCalendar install is used in German language and thus data entered in the calendar can contain umlauts.

Strings in my WebCalendar database use the encoding 'latin1' (ISO-8859-1).

Unfortunately updating the PHP version to anything higher than 5.3 breaks WebCalendar. More specifically, calendar entry titles and descriptions containing umlauts and other special characters are not shown in the calendar.

There has been an according bug report on SourceForge: https://sourceforge.net/p/webcalendar/bugs/2709/

I believe this problem will affect most people using a language other than English.

(I was able to circumvent the problem by switching everything to UTF-8, which, however, required a change in a WebCalendar core PHP file to set the proper encoding, see https://github.com/craigk5n/webcalendar/issues/33).

htukiain commented 7 years ago

please check in case you can change the .htaccess file for encoding. In our installation it fixed issues with umlatus / scandinativan letters.

bbannon commented 7 years ago

We are looking into this. I put in a pull request for a tentative .htaccess file. I'd like to hear comments / suggestions on that. I'm updating the code base to utf-8. Craig is testing that pull request. Also, in my case at least, my ISP has switched to utf-8 as default charset. I don't know if this is a general thing more ISPs will do or not.

FranzGotsis commented 6 years ago

I had the same problem and could solve the issue for MySQL/MariaDB the following way:

  1. Transform all encodings in the database to utf-8 via phpMyAdmin (operating on MySQL and MariaDB).
  2. Ensure that the database connection is using utf-8, by modifiying the file includes/dbi4php.php from line 117 onwards: add the following lines:

    $original_character_set = $c->character_set_name(); if (strpos(strtolower($original_character_set),"utf") == false) { $fgcharsetName = "utf8"; $resultOfCharsetChange = $c->set_charset ($fgcharsetName); }

Side-Effect: A crude change of the encoding for the tables causes the existing special characters (for instance German Umlaute) to be displayed incorrectly. Everything new will be displayed correctly. The way I coped with that is to export the database to a file. Change the encoding to utf-8 correct anything (search/replace) that does not look the way it should do and reimport the file into the existing database. That way all data is displayed correctly. Once everything is moved to utf-8 there is very little need to use another character set and whatever language the user sets in the browser, the event data is displayed correctly. In my case I use English and German language browsers and in both cases the special characters are displayed correctly (Umlaute).