-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
i18n.properties responds with wrong charset #340
Comments
regarding the conventions... take a look: https://ui5.sap.com/#/topic/753b32617807462d9af483a437874b36
So when I save my i18n.properties files with ISO-8859-1 encoding the output of the |
When saving the properties files to ISO8859-1, Edge works fine, but Chrome doesn't. |
Your .properties that your file must be ISO 8859-1 encoded. While ISO 8859-1 supports umlauts, from my understanding Chrome and other browsers convert the received strings to UTF8 before displaying them to the user. This goes wrong for ISO 8859-1 encoded umlauts. Therefore, afaik only ASCII characters can safely be used in .properties files. Other characters must be unicode escaped like in the OpenUI5 Sample App: Also see https://github.com/SAP/ui5-server/issues/7#issuecomment-401023752 |
To my understanding, this is not true. Browsers for each textual resource determine an encoding and then decode the resource based on that encoding. If the browser is able to determine the right encoding for a ISO 8859-1 file, it should properly decode and display umlauts etc. The crucial part is the determination of the encoding. For a secondary resource, it is based on several sources of information:
UI5 runtime mainly relies on the first one. We also suggest a tag in the main page to properly ensure a default encoding of utf-8. For the *.properties files, we expect the server to send the correct Content-Type header with charset=ISO-8859-1. Bringing all this together, I would have expected the following to work:
If you store the file in some other encoding, the server will send an inconsistent response (assuming that the server sends the file as binary or uses the encoding that it knows) From the initial description, it wasn't clear to me whether the expected chain is working or not as expected. |
@codeworrior I tested pretty much that with the OpenUI5 Sample App. I re-created the i18n_de.properties file with ISO 8859-1 encoding and umlauts (part of the ISO 8859-1 charset). With the UI5 Server, in Chrome I get what I think is called "replacement characters": To reproduce yourself:
|
Indeed, I can reproduce the same locally with the zip. But when I put the same sources into a Tomcat with an active UI5 servlet (which I only used to get the I would therefore assume that some middleware in our |
I would rate this as a bug in |
Yes, you are right. This seems to be an issue with the usage of the replaceStream module here: When removing the replaceStream-block, the client receives the correct data. What bothers me is that I don't yet understand the behavior of replaceStream and Nodes http.ServerResponse (which express' When supplying replaceStream with an Piping that stream into the express Long story short, we could exclude non UTF-8 encoded files from the version string replacement. We already exclude *.properties files when building a UI5 project anyways. In addition, it turns out that Note that we use replaceStream also in the UI5 Builder. |
The replaceStream module converts all string it processes to UTF-8. Therefore, stop using it for strings that are not UTF-8 encoded. Resolves https://github.com/SAP/ui5-server/issues/196
The replaceStream module converts all string it processes to UTF-8. Therefore, stop using it for strings that are not UTF-8 encoded. Resolves https://github.com/SAP/ui5-server/issues/196
This should be resolved with UI5 CLI v1.5.3 |
Thx, works if I save the i18n.properties files with ISO-8859-1. Don't think that this is an international solution but it is ok for me in the European area |
Expected Behavior
When using german umlaute like ä,ü,ö or other language specific chraracters in i18n.properties file it is expected that they are displayed as such in the running UI5 application.
Current Behavior
When an Umlaut is used like in "Anträge" it is displayed as "Anträge".
Steps to reproduce the issue
This happens when using "ui5 serve" to serve the development state of the app as well as when using "ui5 build" to build the app and then serve the content of the .dist folder with a webserver.
The i18n.properties file is delivered with
Content-Type: text/plain; charset=ISO-8859-1
.If I use e.g. WebIDE to run my application the i18n.properties has
Content-Type: text/plain
When I save the i18n.properties with charset "ISO 8859-1" and use UI5 tooling to serve the app the result in the browser looks like this: Antr�ge
Context
ui5 --version
when using the CLI):1.4.0
v10.15.0
6.6.0
Mac OS Mojave 10.14.4
Chrome 74.0.3729.131, Firefox 66.0.3, Safari 12.1
Affected components (if known)
Log Output / Stack Trace
The text was updated successfully, but these errors were encountered: