Open adamoutler opened 3 years ago
Thanks for your contribution! Can you expand a bit on what is going wrong exactly? Perhaps I can add a unit test case for this as well.
Not needed. This is a best practice and recommended by static analysis tools. The system defaults to whatever the system default is set to. This constraints it to UTF-8 which is recommended. In the case the system is set to UTF-16, emojis fail.
It's preparation for when this repo upgrades to Java 11/16.
Please rebase your branch on top of latest master to trigger a build :pray:
I've quickly run over this PR.
I think the only relevant change is the one line with addittion of StandardCharsets.UTF_8. The rest should be reverted. StandardCharsets is part of Java 7, so there's no need to upgrade.
It's strange that @adamoutler removed tests for strings with diacritics -- that's where UTF-8 is really used.
System.out.println is for temporary debugging and should have been removed prior to commit/PR.
Other than that, I agree that it is safer to explicitly specify encoding.
Yes. I guess I included items which should not have been in there. The UTF-8 part was discovered as the root of the other problems.
This fixes a problem with UTF-16 chars being read as less number of chars than expected which results in an unclosed expression expecting a closing single quote.