On Fri, 27 Nov 2020 16:57:07 GMT, Roger Riggs <rri...@openjdk.org> wrote:
>> src/java.base/share/classes/java/util/HexFormat.java line 853: >> >>> 851: */ >>> 852: public int fromHexDigit(int ch) { >>> 853: int value = Character.digit(ch, 16); >> >> Do we need to limit parsing the hex digit for only [0-9a-fA-F]? This would >> return `0` for other digits, say `fullwidth digit zero` (U+FF10) > > The normal and conventional characters for hex encoding are limited to the > ASCII/Latin1 range. > I don't know of any use case that would take advantage of non-ASCII > characters. My point is that probably we should define `hexadecimal string` more clearly. In the class description, that exclusively means [0-9a-fA-F] in the context of formatting, but in the parsing, it allows non-ASCII digits. e.g., HexFormat.of().parseHex("\uff10\uff11") Succeeds. I would like consistency here. ------------- PR: https://git.openjdk.java.net/jdk/pull/482