Jump to content

Strange behavior: Pagetable field and German Umlauts


Juergen
 Share

Recommended Posts

Hello @ all,

today I have discovered a strange behavior of outputting German Umlauts in a pagetable field.

In my case I want to output the start date with the Geman month name (in this scenarion "März" which means March in English). März includes a special German character called "Umlaut" which will not be outputted.

Take a look at the screenshots:

1) German

post-2257-0-98987500-1456132406_thumb.pn

As you can see all dates which include the month "März" (=March) will not be displayed in the pagetable field. März includes the special character "ä" and therefore it will not be outputted

2) English

post-2257-0-54540200-1456132468_thumb.pn

The same in English - all dates will be displayed properly.

Has someone discovered the same behavior. It seems that the charset is not UTF-8.

Best regards Jürgen

Link to comment
Share on other sites

Hello Horst,

checklist that helped me in those situations:

  • are all involved php files saved in utf-8 ?
  • do the involved db_tables save the data in utf-8 ?

There are no external php files involved and I am sure that PW core files are in UTF-8.

DB tables should also be in UTF-8.

The date is stored in the db in this format: 2016-03-01 14:00:00

The possible cause could be my output formatting: I use PHP strftime to format my date/time output.

post-2257-0-15521500-1456135153_thumb.pn

Maybe this causes the behaviour but it should not be a problem.

Best regards

Link to comment
Share on other sites

Support for %e is a bit of a fuzzy subject (which is mentioned in the docs). I'd create a small php file and call it directly to check for %e support:

<?php
header('Content-type: text/plain');
echo 'Month is ' . strftime('%e') . PHP_EOL;
?>

EDIT: Didn't look closely enough. As dates in February and April are shown, it's unlikely that it's about %e. Pleaes move on, there's nothing to see here.

Link to comment
Share on other sites

It has definitely to do with the strftime format. If I use the standard format (fe. d-F-Y) it works.

Question:

On the frontend template I have included setlocale to output the correct strftime-format. Will be setlocale automatically included in the admin template or do I have to include it manually? I use the Reno theme.

Best regards

Link to comment
Share on other sites

Have a look at the config file (site/config.php), there is an entry where you can set the timezone.

/**
 * Installer: Time zone setting
 *
 */
$config->timezone = 'Europe/Berlin';

Are the correct locales installed on the server? I've never used setlocale() in a file/template. Also check you php.ini for the right timezone:

date.timezone = Europe/Berlin

For some projects I had to install the php-intl extension, but this was just necessary to localize a date using twig as template engine.

Link to comment
Share on other sites

Thats not the problem,

my configuration is correct: $config->timezone = 'Europe/Vienna', also on the ini.

I guess that if the pagetable gets the data from an json file (I havent looked at it yet) and the file is not UTF-8 and there are special characters in it, it will output an empty string. I had this problem also on a json file on the frontend. After outputting it in UTF-8 all content was displayed properly on the frontend.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...