Modx date formatting not using the correct character set - utf-8

I have a modx site that outputs some dates on a bunch of different pages in both English and French - it worked fine but now the owner is reporting French dates showing 'funny characters'
The database, modx and page are all using UTF8 encoding, the date value (publishedon) is stored as a unix time in the data base and is called like this:
[[+publishedon:strtotime:date=`%B %e, %Y`]]
Which from my understanding is just using the php strtotime function, however on the French pages the date shows up as:
d�cembre 18, 2018
So the Locale functions are working but not the character set, NOW immediately fog that date is some copy from the database:
"Le 18 décembre"
Using the correct characters, so we can see the encoding for the page is correct, but the function appears to be not using the correct character encoding!?
Modx has not been updated.
Does anyone know what might be going on here and how to set the corect encoding for the output?
UPDATED INFORMATION:
there are 2 web contexts defined, English and French. Each has a locale defines as en_EN & fr_FR respectively
the modx_charset is UTF-8 set in the system settings
use_multibyte is enabled in the system settings an mbstring is installed & enabled on the server.
modx version is 2.6.5

Use an utf8 capable locale MODX system setting, like fr_FR.utf8 or similar.
You have to look before, which locales are available on your host.

it worked fine but now the owner is reporting French dates showing 'funny characters'
It's interesting what happened and became the cause..maybe some server updates take place? Sometimes hoster makes an indelible contribution :)
What encoding do you have now in php.ini file?
Additionally what MODX version do you use?
Also please let know what stored for next modx system settings(directly or redefined by context settings):
locale, modx_charset, use_multibyte
Br,
Anton

Related

Can't change language in Steam API

There is Steam API endpoint, fetching APP detailed info, for example:
https://store.steampowered.com/api/appdetails?appids=578080
And it can take just a few parameters:
appids - id of the app
l - language code
cc - currency code
filters - filter results to some particular part, for example filters=price_overview
Everything was working fine until I broke it )))
I started to investigate, which languages are supported and passed a few language parameters:
https://store.steampowered.com/api/appdetails?appids=578080&l=en
https://store.steampowered.com/api/appdetails?appids=578080&l=ru
https://store.steampowered.com/api/appdetails?appids=578080&l=fr
https://store.steampowered.com/api/appdetails?appids=578080&l=es
https://store.steampowered.com/api/appdetails?appids=578080&l=de
And at some point it just stopped switching languages and stuck on English (as default) or German, if I put any other parameter, rather than "en".
"cc" is working and I can switch currencies.
"filters" are working.
But language has stopped changing.
I even tried with different IP's, from my own PC, from my web server and some PHP sandbox services - same thing. The only difference is that sometimes it's stuck on English all the time.
What the heck?
Found an answer.
You have to write full language name, eg: l=english, l=german, l=spanish, l=russian, not just l=en, l=de, l=es or l=ru.
Don't know why it worked before.

How to generate localized report in JasperReports Server?

I've created a jrxml report file. I've added the resourceBundles (pl_PL, en_GB and en_US and the default one also in english) named test.properties, test_pl_PL.properties and so on. And I have added resourceBundle="test" propertety to the tag. I've deployed the report and all related resources.
I am generating my report through rest API v2, namely:
http://localhost:9000/jasperserver/rest_v2/reports/reports/test_summary.pdf
How do I steer in which locale the report is generated? I've tried the Accept-Language in the header (through postman), also I've tried Chrome extensions and Firefox and Opera for all these clientes the report is generated in pl_PL. The only exception is edge browser in which the report is generated in english (default) locale.
Try to pass Locale via userLocale parameter in URL. Like this:
http://localhost:9000/jasperserver/rest_v2/reports/reports/test.pdf&userLocale=pl_PL
Well, many years after initial question, but anyway: report itself has an embedded parameter REPORT_LOCALE. You could set it as usual, trough URL. Example:
https://example.com/jasperserver/rest_v2/reports/folder/Invoice.pdf?REPORT_LOCALE=bg_BG&InvoiceId=2

Concrete5: How to stop macrons disappearing when cache is cleared?

I have a concrete5 site, which uses 'designer content' an add on available via their market place.
Our clients site requires the use of macrons for their language.
Now this is fine throughout 99% of the site, whether hard-coded html or via a content block etc. However, when macrons are used inside a block created with 'designer content' the macron is replaced with a "?"...
Can anyone help?
Unfortunately this site wont let me post an image to help you see whats going on due to my 'low reputation'....riiiiight thats helpful.
Thanks in advance!
usually the apparition of question marks "?" instead of certain characters is the sign of a charset coding problem. With C5 you should be using a generic UTF8 encoding however if your database table was set to use a different charset or if your php settings are set to a different charset, then you will get those weird characters.
You should start with your php.ini and set the charset to utf8
If that doesn't fix the problem, check this thread, it has a useful script to use to fix the database
http://www.concrete5.org/community/forums/usage/utf-8-or-unicode-problems-preventing-corrrupt-fonts-on-the-front/#52300
Be aware however that if content was saved while the charset was not correct, you may discover that the content still looks weird and you will have to insert it again AFTER having set the correct charset.

IIS globalization and Spanish (Latin America) es-419

IIS does not handle the "es-419" correctly. Is there a workaround to get it to work? I am using the following to get the Thread local uiculture set.
<globalization uiCulture="auto" culture="auto"/>
That works fine for all the locales i have tried except for "es-419" which is common from Chrome browsers. If "es-419" is in the list it just uses the default local instead of es.
See if this helps you out to create a custom culture, since the numbered cultures aren't supported.
How to: Create Custom Cultures

How to get firefox language setting? (REALLY)

I know this question has been answered before, but the answer given is not the complete story:
I went into Firefox's Options->Content and removed all languages except German/Germany, and navigator.language hasn't changed - it's still en-GB (I'm in the UK).
I'm told if I get the German Firefox INSTALL it will work, but I shouldn't need to do that, right?
The useragent string still contains en-GB, too; but the accept-language on HTTP headers IS set correctly. So this seems to be a bug in Firefox, I spent a bit of time wading through their bugzilla, but I can't see this exact bug logged, though to me it seems a pretty huge oversight?
Both navigator.language and the HTTP User-Agent header use the value of the preference "general.useragent.locale", which is hard-coded in intl.properties to the locale of the Firefox build you downloaded:
http://mxr.mozilla.org/mozilla-central/source/toolkit/locales/en-US/chrome/global/intl.properties#8
Or for your en-GB build:
http://hg.mozilla.org/l10n-central/en-GB/file/88dd673c01f1/toolkit/chrome/global/intl.properties#l8
If you'd like to change it for your build, just load about:config, find general.useragent.locale, double-click it, and change the value.
I would recommend to use a Firefox Add-on for this task. Simple Locale Switcher, Locale Switcher or Quick Locale Switcher etc. (* Caution some of this Add-ons may contain ad ware or may not work if you've just updated firefox).
*Another solution is to download a different old firefox version using the language/locale. (Caution) You need and install it in a different folder so you won't overwrite your existing version. Download here I'm using firefox 28 in Spanish. I disabled updates and I rejected using it as my default browser. Only one firefox version should be running at the same time if you do this.
I would assume that navigator.language returns it's interface language (I assume is GB English), not one that it wants documents in. User-agent string too report which version of firefox was downloaded.
Accept-language is what destination server should check.
I consider this behavior of his quite correct (assuming that it's interface (menus and such) are really in GB english).
in firefore, about:config, modify the value of "intl.accept_languages", to your required locale, let's say de-DE will do.
If you want the Accept-Language value, you can't retrieve if using client-side JavaScript. You'll have to get it from your server.
If you really want this value in client-side JavaScript, then read it on the server and write it back to the client:
<script type="text/javascript">
// setting the accept language HTTP header value
// in client-side JavaScript from PHP
var acceptLanguage = '<?php echo $_SERVER["HTTP_ACCEPT_LANGUAGE"]; ?>';
</script>

Resources