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

update to apache configurations2. load properties files with default utf-8 encoding #640

Merged
merged 4 commits into from Mar 8, 2021

Conversation

ancho
Copy link
Member

@ancho ancho commented Apr 28, 2020

This is an update to apache commons configuration 2.7 which is up to date and much more configurable than 1.10.

You can now configure the encoding that should be used loading the properties file in a fluent way.

This PR makes #624 obsolete. But without the original PR we wouldn't even know that 1.10 had an encoding issue.

The only thing that is missing:

  • add cli option (--prop-encoding) to configure property encoding that should be used

@ancho ancho force-pushed the update/apache-configurations branch from 1ff1e3e to ee64954 Compare April 28, 2020 23:09
@coveralls
Copy link

coveralls commented Apr 28, 2020

Coverage Status

Coverage increased (+0.3%) to 82.945% when pulling 4d32d38 on ancho:update/apache-configurations into 24722a6 on jbake-org:master.

@ancho
Copy link
Member Author

ancho commented Apr 29, 2020

What's wrong with windows builds and utf-8?

Test on appveyor fails with

ConfigUtilTest > shouldLoadPropertiesWithUtf8Encoding() FAILED
    java.lang.AssertionError: 
    Expecting:
     <"????????Properties??(Property value in Chinese will let property `site.about` missing due to Apache Configuration implementation.)">
    to contain:
     <"中文属性使用默认Properties编�?"> 
        at org.jbake.app.configuration.ConfigUtilTest.shouldLoadPropertiesWithUtf8Encoding(ConfigUtilTest.java:323)

But the properties file is utf-8

file C:\projects\jbake\jbake-core\src\test\resources\fixture\jbake.properties
C:\projects\jbake\jbake-core\src\test\resources\fixture\jbake.properties: UTF-8 Unicode text

hmmm....is this java.io (UTF8) vs. java.nio (UTF-8)?
https://docs.oracle.com/javase/8/docs/technotes/guides/intl/encoding.doc.html

@ancho ancho force-pushed the update/apache-configurations branch from 0ed4c08 to 224672f Compare April 29, 2020 07:07
@ancho
Copy link
Member Author

ancho commented Apr 29, 2020

@jonbullock , @manikmagar
Ok. I give up. I'm to stupid fixing the appveyor windows builds. Any ideas?

@ancho
Copy link
Member Author

ancho commented Apr 29, 2020

All right. Setting jvm parameter file.encoding to UTF-8 for windows solves the issue.
./gradlew -Dfile.encoding=UTF-8 -i check
I will cleanup/sqash the mess.

@ancho ancho force-pushed the update/apache-configurations branch from e08bb42 to a842fbe Compare April 29, 2020 17:06
@ancho ancho changed the title [WIP] update to apache configurations2. load properties files with default utf-8 encoding update to apache configurations2. load properties files with default utf-8 encoding May 1, 2020
Copy link
Member

@manikmagar manikmagar 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 to me.

@jonbullock jonbullock added this to the v2.7.0 milestone May 12, 2020
@jonbullock
Copy link
Member

👍

@ancho ancho force-pushed the update/apache-configurations branch from a0b4584 to 604d470 Compare February 24, 2021 21:54
@jonbullock jonbullock modified the milestones: v2.7.0, v2.6.6 Mar 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants