On Thu, 19 May 2022 12:19:25 GMT, ExE Boss <d...@openjdk.java.net> wrote:

>> - use `String.equalsIgnoreCase()` instead of hand-written code relying on 
>> `String.charAt()`
>> - use `String.compareToIgnoreCase()` instead of hand-written code relying on 
>> `String.charAt()`
>> - drop branches that are never executed
>> - drop unused argument from `URI.resolvePath()`
>> - simplify String-related operations
>
> The `String.equalsIgnoreCase(…)` and `String.compareToIgnoreCase(…)` changes 
> are incorrect, as the `String.*IgnoreCase(…)` methods compare all **Unicode** 
> code points case‑insensitively using **Unicode** rules for the current or 
> specified locale, whereas the **URI** specification does case‑insensitive 
> comparison only for characters in the **US‑ASCII** range [[RFC3986]].
> 
> --------------------------------------------------------------------------------
> 
> https://github.com/openjdk/jdk/blob/408a3a8e29006798071cd6f185e415bc2bc62282/src/java.base/share/classes/java/net/URI.java#L1825-L1830
>  
> https://github.com/openjdk/jdk/blob/408a3a8e29006798071cd6f185e415bc2bc62282/src/java.base/share/classes/java/net/URI.java#L1832-L1844
> 
> [RFC3986]: https://datatracker.ietf.org/doc/html/rfc3986

@ExE-Boss 

> String.*IgnoreCase(…) methods compare all Unicode code points 
> case‑insensitively using Unicode rules for the current or specified locale, 
> whereas the URI specification does case‑insensitive comparison only for 
> characters in the US‑ASCII range

Aren't all the items of US-ASCII range belong to Unicode regardless of locale?

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

PR: https://git.openjdk.java.net/jdk/pull/8397

Reply via email to