On Sun, 27 Apr 2025 19:10:31 GMT, Anthony Scarpino <ascarp...@openjdk.org> 
wrote:

>> src/java.base/share/classes/java/security/PEMDecoder.java line 213:
>> 
>>> 211:         Objects.requireNonNull(str);
>>> 212:         try {
>>> 213:             return decode(new ByteArrayInputStream(str.getBytes()));
>> 
>> `str.getBytes()` will return a byte array encoded in the default charset, 
>> which these days is likely to be UTF-8, but might be something completely 
>> bizarre. You probably want `str.getBytes(StandardCharsets.ISO_8859_1)`.
>> 
>> It could be worth running your unit tests in several different locales in 
>> order to catch similar issues.
>
> What about the other decode methods that read from InputStream?  I thought it 
> would be inconsistent to read `decode(String)` as a ISO 8859-1, but 
> `decode(InputStream)` as a different charset.

I believe this has been addressed

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/17543#discussion_r2089788429

Reply via email to