RFR: 8316734: URLEncoder should specify that replacement bytes will be used in case of coding error
Daniel Fuchs
dfuchs at openjdk.org
Tue Nov 21 14:31:29 UTC 2023
On Tue, 21 Nov 2023 14:21:10 GMT, Darragh Clarke <dclarke at openjdk.org> wrote:
>> src/java.base/share/classes/java/net/URLDecoder.java line 158:
>>
>>> 156: * If any consecutive well-formed escape sequences cannot
>>> 157: * be decoded as a sequence of characters in the supplied {@code Charset}
>>> 158: * {@linkplain java.nio.charset.CharsetDecoder##cae the replacement character} will be used.
>>
>> I think it would be a bit clearer to say that erroneous bytes are replaced with the Charset's replacement value.
>
> Thanks for the suggestion, I just wanted to make sure I was understanding you correctly before committing the change.
>
> Would it be something like this?
>
> ```
> * Erroneous bytes are replaced with the supplied {@code Charset}'s
> * {@linkplain java.nio.charset.CharsetDecoder##cae replacement value}.
I am OK with new text on the condition it is moved inside the paragraph that talks about decoding (appended to lines 147-148 above):
* The supplied charset is used to determine
* what characters are represented by any consecutive escape sequences of
* the form "<i>{@code %xy}</i>". Erroneous bytes are replaced with the
* supplied {@code Charset}'s {@linkplain java.nio.charset.CharsetDecoder##cae
* replacement value}.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16709#discussion_r1400685430
More information about the net-dev
mailing list