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

8301991: Convert l10n properties resource bundles to UTF-8 native #15694

Conversation

justin-curtis-lu
Copy link
Member

@justin-curtis-lu justin-curtis-lu commented Sep 12, 2023

JDK .properties files still use ISO-8859-1 encoding with escape sequences. It would improve readability to see the native characters instead of escape sequences (especially for the L10n process). The majority of files changed are localized resource files.

This change converts the Unicode escape sequences in the JDK .properties files (both in src and test) to UTF-8 native characters. Additionally, the build logic is adjusted to read the .properties files in UTF-8 while generating the ListResourceBundle files.

The only escape sequence not converted was \u0020 as this is used to denote intentional trailing white space. (E.g. key=This is the value:\u0020)

The conversion was done using native2ascii with options -reverse -encoding UTF-8.

If this PR is integrated, the IDE default encoding for .properties files need to be updated to UTF-8. (IntelliJ IDEA locks .properties files as ISO-8859-1 unless manually changed).


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8301991: Convert l10n properties resource bundles to UTF-8 native (Enhancement - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/15694/head:pull/15694
$ git checkout pull/15694

Update a local copy of the PR:
$ git checkout pull/15694
$ git pull https://git.openjdk.org/jdk.git pull/15694/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 15694

View PR using the GUI difftool:
$ git pr show -t 15694

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/15694.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 12, 2023

👋 Welcome back jlu! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 12, 2023
@openjdk
Copy link

openjdk bot commented Sep 12, 2023

@justin-curtis-lu The following labels will be automatically applied to this pull request:

  • build
  • client
  • compiler
  • core-libs
  • i18n
  • javadoc
  • jmx
  • kulla
  • net
  • security
  • serviceability

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added javadoc javadoc-dev@openjdk.org security security-dev@openjdk.org serviceability serviceability-dev@openjdk.org jmx jmx-dev@openjdk.org build build-dev@openjdk.org client client-libs-dev@openjdk.org core-libs core-libs-dev@openjdk.org compiler compiler-dev@openjdk.org net net-dev@openjdk.org kulla kulla-dev@openjdk.org i18n i18n-dev@openjdk.org labels Sep 12, 2023
@mlbridge
Copy link

mlbridge bot commented Sep 12, 2023

Webrevs

p.load(new FileInputStream(propertiesPath));
try (FileInputStream input = new FileInputStream(propertiesPath);
// Read in JDK .properties files in UTF-8
InputStreamReader streamReader = new InputStreamReader(input, StandardCharsets.UTF_8)
Copy link
Member

Choose a reason for hiding this comment

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

Can we just uses Files.newBufferedReader(Path.of(propertiesPath)) instead?

Copy link
Member

@naotoj naotoj 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, although I did not look at each l10n file, but sampled some. Thanks for tackling this conversion.

@openjdk
Copy link

openjdk bot commented Sep 13, 2023

@justin-curtis-lu This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8301991: Convert l10n properties resource bundles to UTF-8 native

Reviewed-by: naoto

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 36 new commits pushed to the master branch:

  • 3b0a6d2: 8314226: Series of colon-style fallthrough switch cases with guards compiled incorrectly
  • ff240a9: 8316087: Test SignedLoggerFinderTest.java is still failing
  • a731a24: 8315934: RISC-V: Disable conservative fences per vendor
  • b3dad24: 8316021: Serial: Remove unused Generation::post_compact
  • f9ab115: 8316050: Use hexadecimal encoding in MemorySegment::toString
  • f804f86: 8314612: TestUnorderedReduction.java fails with -XX:MaxVectorSize=32 and -XX:+AlignVector
  • f8df754: 8311207: Cleanup for Optimization for UUID.toString
  • fecd2fd: 8315898: Open source swing JMenu tests
  • bb6b3f2: 8315761: Open source few swing JList and JMenuBar tests
  • 2d168c5: 8313202: MutexLocker should disallow null Mutexes
  • ... and 26 more: https://git.openjdk.org/jdk/compare/d0be73a78038faf9509623bc4ba71eb4385cd645...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 13, 2023
@justin-curtis-lu
Copy link
Member Author

Looks good to me, although I did not look at each l10n file, but sampled some. Thanks for tackling this conversion.

Thanks for the review; (In addition to testing), I ran a script to verify only white space escape sequences exist in JDK .properties files. (Excluding escape sequences in test files that should remain as is for the purpose of the test)

@justin-curtis-lu
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Sep 14, 2023

Going to push as commit b55e418.
Since your change was applied there have been 64 commits pushed to the master branch:

  • d475f61: 8315731: Open source several Swing Text related tests
  • 4415261: 8315683: Parallelize java/util/concurrent/tck/JSR166TestCase.java
  • b2e9106: 8313452: Improve Classfile API attributes handling safety
  • 2a6fb9c: 8316147: Remove serviceability/sa/TestJhsdbJstackMixed.java from -Xcomp problem list
  • ca747f0: 8315678: Classfile API ConstantPool::entryCount and ConstantPool::entryByIndex methods are confusing
  • 6d47fc6: 8313258: RuntimeInvisibleTypeAnnotationsAttribute.annotations() API Index out of Bound error
  • c7d306c: 8315541: Classfile API TypeAnnotation.TargetInfo factory methods accept null labels
  • c11f835: 8315824: Open source several Swing Text/HTML related tests
  • 5cea53d: 8315810: Reimplement sun.reflect.ReflectionFactory::newConstructorForSerialization with method handles
  • eb1f67b: 8315937: Enable parallelism in vmTestbase/nsk/stress/numeric tests
  • ... and 54 more: https://git.openjdk.org/jdk/compare/d0be73a78038faf9509623bc4ba71eb4385cd645...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Sep 14, 2023
@openjdk openjdk bot closed this Sep 14, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Sep 14, 2023
@openjdk
Copy link

openjdk bot commented Sep 14, 2023

@justin-curtis-lu Pushed as commit b55e418.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build build-dev@openjdk.org client client-libs-dev@openjdk.org compiler compiler-dev@openjdk.org core-libs core-libs-dev@openjdk.org i18n i18n-dev@openjdk.org integrated Pull request has been integrated javadoc javadoc-dev@openjdk.org jmx jmx-dev@openjdk.org kulla kulla-dev@openjdk.org net net-dev@openjdk.org security security-dev@openjdk.org serviceability serviceability-dev@openjdk.org
3 participants