SAP-archive / connect-openui5

Connect middleware for OpenUI5
Apache License 2.0
28 stars 13 forks source link

Enforcing ISO-8859-1 on .properties causes issues #20

Closed enzo1982 closed 5 years ago

enzo1982 commented 6 years ago

In lib/properties.js the ISO-8859-1 charset is forced upon all .properties files. This makes it difficult to use them for i18n with non-Latin based languages and causes issues even with Latin based ones (when the server you're deploying to sets UTF-8 by default).

In our development environment we are disabling that content type header or set it to UTF-8 in order to be able to do i18n without such issues and restrictions.

I realize that .properties files orginally come from Java and were defined to be ISO-8859-1 encoded in earlier Java versions. With Java 9, however, the default encoding for .properties files changed to UTF-8 (see JEP 226), so if there ever was a reason to enforce ISO-8859-1 encoding on them, it should be gone now.

Regarding ISO-8859-1 on .properties files, the SAP UI5 coding guidelines say "This is the status quo. As this causes issues, it may be subject to change.".

So what do you think about changing it now and setting the content type header to UTF-8 or removing the explicit header altogether? I think removing the header would come closest to the Java 9 behavior as it would leave charset detection to the browser and allow everyone to use either UTF-8 or ISO-8859-1.

RandomByte commented 6 years ago

I created https://github.com/SAP/ui5-server/issues/7 to also check on this in the context of the new build tooling.

matz3 commented 5 years ago

We are working on a concept to better handle encoding of properties files in the new tooling: https://github.com/SAP/ui5-tooling/pull/168

For this project we currently don't plan to change how properties files are handled, therefore closing as wontfix.