Juergen Posted February 22, 2016 Share Posted February 22, 2016 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 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 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 More sharing options...
horst Posted February 22, 2016 Share Posted February 22, 2016 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 ? Link to comment Share on other sites More sharing options...
Juergen Posted February 22, 2016 Author Share Posted February 22, 2016 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. Maybe this causes the behaviour but it should not be a problem. Best regards Link to comment Share on other sites More sharing options...
BitPoet Posted February 22, 2016 Share Posted February 22, 2016 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 More sharing options...
Juergen Posted February 22, 2016 Author Share Posted February 22, 2016 @BitPoet, yes, the "%e" could not be the cause because I can output the date on frontend without any problems. It only seems that the pagetable field could not output a date in this format. Link to comment Share on other sites More sharing options...
Juergen Posted February 22, 2016 Author Share Posted February 22, 2016 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 More sharing options...
justb3a Posted February 22, 2016 Share Posted February 22, 2016 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 More sharing options...
Juergen Posted February 22, 2016 Author Share Posted February 22, 2016 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now