New locale-codes under UTF-8?

New locale-codes under UTF-8?

by Ralf Hilgenstock -
Number of replies: 5
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Translators
Hi Koen,

I'm searching for the correct locale code for a xampp server under windows for the german dates. All codes I found doesn't support the Umlaute (ä in März).

Ralf
Average of ratings: -
In reply to Ralf Hilgenstock

Re: New locale-codes under UTF-8?

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi Ralf,

I'm actively working on it just now. It seems that Windows locales, although seems to be defined in a lot of pagecodes (iso-8859-1, unicode...) are returned by php in iso-8859-1 pagecode always.

I'm surfing the net to find any solution to this (the ability to specify the UTF8 pagecode from PHP) but, for now, all the tests I've performed aren't satisfactory at all. I hope we'll find one solution soon!

As a final trick we could try to convert such iso-8859-1 string to UTF8 before visualisation but it's far from perfect. sad

Anyway, if somebody finds any reliable information about PHP, UTF-8 and Win32 locales, it would be really welcome!

Ciao smile
In reply to Eloy Lafuente (stronk7)

Re: New locale-codes under UTF-8?

by Petr Skoda -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers
I did my searching about a year ago, AFAIK no way to force encoding in windows locale - it always defautls to plain old single byte win 3.1 compatible encodings sad

The only solution I see is to add some new settings into langconfig:

$string['winlocale'] = 'csy';
$string['wincharset'] = 'cp1250';

and add wrapper functions around native php functions that would do the charset conversions. I know it might be slower under windoze, but it should work for all supported windows locales and under nix it should be nearly as fast as before...

skodak
In reply to Petr Skoda

Re: New locale-codes under UTF-8?

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Yep,

it was the home-made solution, although we need to know in which charset is the locale info provided for *each* lang (cp1250 for csy, Big5 for chinese.....). I hope that some list of default charsetsfor each Win32 lang was available somewhere... thoughtful

Also I was looking for something like "esp_esp.65001" as locales because I found some examples of Japanese deciding the locale encoding by adding the codepage after the country. But it doesn't seem to work for UTF-8 (codepage 65001 or CP_UTF8) sad

So yes, I think that converting strftime() results based on wincharset could be a nice solution. Only moodle date2string functions need to be converted, isn't it?

Ciao smile
In reply to Ralf Hilgenstock

Re: New locale-codes under UTF-8?

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi,

since some hours ago nearly all the lang packs have been updated and now they include the proper information to set the locale code under Win32. This info is part of every lanconfig.php file (where all the non-textual and configuration strings for the language reside).

Also, Moodle code (1.6dev only, of course), have been updated to use such Win32 locales and it seems to work pretty well.

While we was looking and setting the correct locales, some problems inside some language packs have been detected. Also, we haven't found the correct locales for some of them (and believe me if I say that thousands of pages have been searched trying to find a solution for them!).

In this page: http://docs.moodle.org/en/Table_of_locales you will find a brief explanation and the table of locales used. In order to perform quick tests in your language, the current build of the 1.6 Windows Complete Package includes all the code.

Please, test it and send any problem to http://bugs.moodle.org and/or post them here. Any feedback will be appreciated!

TIA and ciao smile
In reply to Eloy Lafuente (stronk7)

Re: New locale-codes under UTF-8?

by Ralf Hilgenstock -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Translators
Hi Eloy,

your codes seem to be ok. Now a new problem:

Local windows system under uniserver. I updated the system with 1.6 beta, migrated the database and updated the german lang package.
The german Umlaute ÄÜÖ are shown correct on all pages except http://localhost/moodle/admin/index.php. The same texts are correct on http://localhost/moodle/admin/configure.php.

Ralf