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

WebCalendar 1.2.5 and umlauts #129

Open mtjmohr25 opened 5 years ago

mtjmohr25 commented 5 years ago

Hello,

I am still successfully using WebCalendar 1.2.5 for patient documentation system. I use this calendar to make patient appointments and, for instance, calculate if a patient has been missing her / his last appointment scheduled. An update to any other version up to v1.2.9 does not seem to be helpful for my problem.

What drives me crazy is the impossibility to get any kind of umlauts into "short description", "long description" and "location" when viewing the data for mere display or changing them. "Categories", however, are displayed correctly with umlauts.

I have already made the following modifications:

MY.INI: [mysqld] character-set-server = utf8

HTTPD.CONF: AddDefaultCharset utf-8

/webcalendar/translations/German.txt: charset: UTF-8 (an alternation with German-UTF8.txt does not bring any change)

MySQL 5.6.34: change of webcal_entry to the collation of utf8_general_ci

What else can I do to handle this issue?

Best regards

Markus

mtjmohr25 commented 5 years ago

I have found a partial solution after a long period of search:

/webcalendar/login.php is invoked within my system so as to be able to reside within the same PHP session structure like this:

ip_address_of_application_server:port/application_path/webcalendar/login.php?patID=xyz

patID is a numerical autoincrement index value by which I can identify the patients (of course, in the database they carry their clear names, addresses etc. in a special table).

Thus, since the main application has an ISO-8859-1 default character set, I have no good chance to transfer this in the above-mentioned call.

What helps here ist to build in the following code into edit_entry.php and edit_entry_handler.php:

[...]
include_once 'includes/init.php';
// Anpassung an den Pfad zur functionsDatabase.php zum Suche der updateNaechsterTermin
include_once '../resources/functionsDatabase.php';
include_once '../resources/functions.php';
include_once '../general_utf8.php';
[...]

general_utf8.php, hence, contains all the necessary code for handling paths, variables etc. for the application plus, at its end, the change of the character set with the following commands:

[...]
$CHARSET = "UTF-8";
header('Content-type: text/html; charset=' . strtolower($CHARSET));

ob_end_flush();
?>

This helps for everything but displaying patients' umlauts in the "brief description" area, here umlauts are still displayed as ISO-8859-1 characters.

I have not been able to handle this yet. It's neither a change of the translation files from normal to UTF-8 nor a switch between ISO-8559-1 and UTF-8 within the following changed code within edit_entry.php:

[..., line 483]
if ( empty ( $name ) )
{
    $patID = $_SESSION['webcal_patientID'];
    $res = dbi_execute ( "SELECT Vorname, Nachname FROM dat_patient WHERE ID = $patID ");
    if ( $res ) 
    {
        $row = dbi_fetch_row ( $res , 0 );
        $name = $row[1].', '.$row[0];
    }
    else
        $name = 'Abfrage fehlgeschlagen';
}

Additionally, about 200 lines farther below, I have changed

. 'size="25" value="' . htmlspecialchars ( $name ) . '" /></td>

to

. 'size="25" value="' . htmlspecialchars ( $name, ENT_COMPAT,'ISO-8859-1', true ) . '" /></td>

or

. 'size="25" value="' . htmlspecialchars ( $name, ENT_COMPAT,'UTF-8', true ) . '" /></td>

without any consequence of a display change.

So, if anyone has got an idea, I'd be very thankful.

Best regards

Markus

FranzGotsis commented 5 years ago

Hello,

I am using WebCalendar 1.2.9 (with some minor patches) in a German environment (mit Umlauten). What I did was to change all table encodings in a MySQL database to UTF8 (via phpMyAdmin) and I made sure that all language files of WebCalendar are using utf-8 as well.

You can check that by looking at the page source code in the browser. Take a look at the first line it should read:

<?xml version="1.0" encoding="UTF-8"?>

As I had started with WebCalendar release 1.2.7 I had to translate the encoding. For that I used a phpMyAdmin feature to export the whole database into a text file (basically a set of SQL-commands). I changed the encoding reimported the database and everything was fine.

In case you still have problems, I can go into more details.

Release 1.3.0 does have quite a large number of changes that I do not need right now, so I have not upgraded yet (but eventually I will).

Release 1.2.5 is quite old and does have a number of security issues, so I would say it is definitely worth it to upgrade.

kind regards Franz Gotsis from Munich btw - MariaDB works fine as well, including the use of "Umlaute" (äöüß).