RFR: 8264200: java/nio/channels/DatagramChannel/SRTest.java fails intermittently
Daniel Fuchs
dfuchs at openjdk.java.net
Tue Apr 6 14:27:26 UTC 2021
On Tue, 6 Apr 2021 14:08:01 GMT, Conor Cleary <ccleary at openjdk.org> wrote:
>> Using an 8-bit charset might be a better choice, US_ASCII is only 7bit and might produce some unmappable characters.
>> ISO_8859_1 would be a better choice.
>
> Fair enough. Is there any reason then why UTF-8 would be used over ISO_8859_1 then, given what you said above about character mapping? Or vice-versa
The message sent by the writer is "hello" - it only contains ASCII characters, so any of US-ASCII, UTF-8, or ISO-8859-1, which are all compatible with ASCII (meaning: all these encode ASCII chars in the same way) would work.
In fact any charset in which "hello" is mappable would work. We simply need to make sure to use the *same charset* when encoding or decoding.
-------------
PR: https://git.openjdk.java.net/jdk/pull/3354
More information about the nio-dev
mailing list