delight-im / PHP-I18N

Internationalization and localization for PHP
MIT License
57 stars 13 forks source link

Support explicit encodings other than UTF-8 #4

Open ocram opened 5 years ago

ocram commented 5 years ago

Source: https://www.gnu.org/software/gettext/manual/html_node/Header-Entry.html

LS05 commented 5 years ago

Can I work on this issue?

ocram commented 5 years ago

Do you know what needs to be done?

In general, we like to talk and discuss concepts and details before building the implementation, and also during the process, to avoid implementations that go in the wrong direction or miss critical details.

LS05 commented 5 years ago

Hey @ocram I will first understand what needs to be done, and then come up with a plan in the coming days!

LS05 commented 5 years ago

I have searched for "UTF8" in the repository and this shell script i18n.sh and this class I18n have a hardcoded dependency on UTF8.

Am I missing something else? Am I on the right track?

ocram commented 5 years ago

You’re right, in both of these files, some changes and generalization are necessary.

The shell script would need to accept an optional encoding supplied as a parameter, in a format that works for the Gettext utilities.

In the PHP code, we don’t want to try all those possible encodings for every locale that is specified, so it should definitely first detect which encodings are relevant for each specific locale in question (see the list above). The detected set of relevant encodings should be tried only after UTF-8.

Finally, whatever encoding is used, this must be compatible with PHP’s current internal encoding (and the encoding of any output), whichever those may be.

By the way, I’m not sure how urgent all this is, because most applications should be using UTF-8 now, especially newer ones.