Skip to content
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

[RFC] 0007 Properties File Encoding #168

Merged
merged 15 commits into from
Jul 31, 2019
Merged

Conversation

tobiasso85
Copy link
Contributor

@tobiasso85 tobiasso85 commented Jul 15, 2019

Add a fix for properties file encoding when they are part of a build or served such that they can always be interpreted as UTF-8 encoded files.

Read: 0007-properties-file-encoding.md
Merged: 0007-properties-file-encoding.md

@CLAassistant
Copy link

CLAassistant commented Jul 15, 2019

CLA assistant check
All committers have signed the CLA.

change to 0007 because 0006 is already present
@tobiasso85 tobiasso85 changed the title [RFC] 0006 Properties File Encoding [RFC] 0007 Properties File Encoding Jul 15, 2019
@tobiasso85 tobiasso85 added the RFC Request for Comment (pull request) label Jul 15, 2019
rfcs/0006-properties-file-encoding.md Outdated Show resolved Hide resolved
rfcs/0006-properties-file-encoding.md Outdated Show resolved Hide resolved
rfcs/0006-properties-file-encoding.md Outdated Show resolved Hide resolved
rfcs/0006-properties-file-encoding.md Outdated Show resolved Hide resolved
rfcs/0006-properties-file-encoding.md Outdated Show resolved Hide resolved
rfcs/0007-properties-file-encoding.md Outdated Show resolved Hide resolved
The `ui5-builder` should offer a task called `encodePropertiesFiles` which escapes all special characters in unicode using the unicode escape sequence `\uXXXX`.
It should use a processor called `stringEscaper` which escapes special characters in files and is used within the task to operate only on `*.properties` files.
The processor offers a function called `escapeNonAsciiAsUnicode` which performs the unicode escaping.
The task should be run first (before `replaceCopyright`) for all types.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm... isn't adding new standard tasks always changing the ordering of the custom task as well?
So if somebody already wanted to be "first" and has registered a custom task before replaceCopyright, they are now only 2nd...

Not sure if we see that as a problem, but the ordering of tasks seems important since their results might depend on eachother, right?

rfcs/0007-properties-file-encoding.md Outdated Show resolved Hide resolved
rfcs/0007-properties-file-encoding.md Outdated Show resolved Hide resolved
Adjust content because files' content should always be escaped.
Adjust to latest discussion regarding encoding parameter
@SAP SAP deleted a comment from CLAassistant Jul 23, 2019
Adjust to latest changes in ui5-builder
@tobiasso85
Copy link
Contributor Author

would it make sense to later on introduce an auto-detection feature such as:
https://github.com/sonicdoe/detect-character-encoding
?

@RandomByte
Copy link
Member

would it make sense to later on introduce an auto-detection feature such as: sonicdoe/detect-character-encoding?

I like that this module also returns a confidence score. But this already shows the problem: some character codes exist in multiple encodings.

I definitely don't want to identify an encoding wrong, which would result in the wrong characters being used in a translation file. So for me, the confidence score would need to be near 100% to be acceptable to work with.

But even in cases where a file can be identified 100% correctly, if it changes and the confidence score drops we would need to prompt the developer to specify the encoding anyways. This situation might occur in case of automated commits from a translation system that add new special characters. This would then break the build. I don't like that possibility 😕

@codeworrior
Copy link
Member

@RandomByte: this was exactly the reason why we always tried to avoid sniffing in the Java tooling and server, too.

@tobiasso85
Copy link
Contributor Author

would it make sense to later on introduce an auto-detection feature such as: sonicdoe/detect-character-encoding?

I like that this module also returns a confidence score. But this already shows the problem: some character codes exist in multiple encodings.

I definitely don't want to identify an encoding wrong, which would result in the wrong characters being used in a translation file. So for me, the confidence score would need to be near 100% to be acceptable to work with.

But even in cases where a file can be identified 100% correctly, if it changes and the confidence score drops we would need to prompt the developer to specify the encoding anyways. This situation might occur in case of automated commits from a translation system that add new special characters. This would then break the build. I don't like that possibility 😕

This could also lead then to a problem when some files are served with one encoding and others with another one^^

Copy link
Member

@RandomByte RandomByte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

rfcs/0007-properties-file-encoding.md Outdated Show resolved Hide resolved
rfcs/0007-properties-file-encoding.md Outdated Show resolved Hide resolved
@RandomByte
Copy link
Member

This RFC looks pretty much done to me.

Any further feedback from any of you @Thodd, @tobiasso85, @codeworrior?

@tobiasso85
Copy link
Contributor Author

This RFC looks pretty much done to me.

Any further feedback from any of you @Thodd, @tobiasso85, @codeworrior?

Looks good to me

@matz3
Copy link
Member

matz3 commented Jul 31, 2019

Also LGTM

@RandomByte
Copy link
Member

Please squash and merge!

@tobiasso85 tobiasso85 merged commit cc4ca8e into master Jul 31, 2019
@tobiasso85 tobiasso85 deleted the rfc-properties-file-encoding branch July 31, 2019 11:29
@RandomByte
Copy link
Member

Demo: SAP/openui5-sample-app#54

@RandomByte
Copy link
Member

RandomByte commented Aug 1, 2019

Released with UI5 CLI v1.7.0

@RandomByte RandomByte restored the rfc-properties-file-encoding branch December 17, 2019 16:30
@RandomByte RandomByte deleted the rfc-properties-file-encoding branch December 17, 2019 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFC Request for Comment (pull request)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants