On Tue, 5 Aug 2025 08:29:21 GMT, Volkan Yazici <vyaz...@openjdk.org> wrote:

>> Fix `HKSCS` encoder to correctly set the replacement character, and add 
>> tests to verify the `CodingErrorAction.REPLACE` behavior of all available 
>> encoders.
>
> test/jdk/sun/nio/cs/TestEncoderReplaceLatin1.java line 139:
> 
>> 137:             return coderResult.isUnmappable();
>> 138:         };
>> 139:     }
> 
> I'd appreciate it if you can double-check these _"Is the given `char[]` 
> unmappable for a particular encoder?"_ test generators.

I might be missing something you're trying to do here,  but any reason why we 
can't just go

  return c -> !encoder.canEncode(c[0]);

as the predicate? I think we are doing 'single char', no surrogates,  here, 
right?

or simply do with

    private static char[] findUnmappable(CharsetEncoder encoder) {
        for (char c = 0; c < 0xff; c++) {
            if (!encoder.canEncode(c))
                return new char[]{c};
        }
        System.err.println("Could not find an unmappable character!");
        return null;
    }

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26635#discussion_r2255587104

Reply via email to