-
Notifications
You must be signed in to change notification settings - Fork 331
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
bugfix(JstlLocalization): fix parsing utf8 strings #1020
base: master
Are you sure you want to change the base?
Conversation
Hi @khajavi, thanks for sending us this PR. I'm just not sure if adding it to the anyway, you're able to fix it easily by specializing
|
Apparently is possible to load UTF-8 encoded data from properties file. I think this is useful for languages with non ocidental alphabets (arabic, russian, etc). @khajavi is having an issue because of that in Mamute while trying to translate the website content to his language, check caelum/mamute#190. We can add this custom component to Mamute core, but I think that other VRaptor users might have the same problem in the future. What do you think? I'm not sure if this is the best solution yet (forcing utf-8 properties for everyone) and we should probably improve this code and add tests before merging but I think it is worth of discussing a solution in this PR. |
Even if it's possible to read property files as UTF-8, it would cause problems with all other tools that read/write these files, e.g. IDE editors, which assume the standard latin1 encoding. Even if the encoding is latin1, it's still possible to embed unicode characters with the unicode escape syntax. I'm not sure how comfortable it is to create such files, though. The eclipse property file editor for example actually creates unicode escape sequences when entering non-latin1 characters in to a property file. |
Be extremely careful with this! properties file are ISO-8859-1 by specification, every properties tool will consider that. Also you simply cannot change the default to UTF-8 because all projects already running VRaptor today are certainly using ISO-8859-1 for properties files. |
final ClassLoader classLoader = loader; | ||
final boolean reloadFlag = reload; | ||
InputStream stream; | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use try-with-resources here.
@khajavi we left a few suggestions on your code, can you take a look on it? |
Hey @khajavi Can I help you to improve the code? I would like to approve that pull request. :) |
Issue solved: caelum/mamute#190