Merged
Conversation
Add Encode::Encoding mime_name() and a Perl-canonical Name mapping so HTTP::Message->content_charset (via IO::HTML::find_charset_in) and $res->encoding work for ASCII/UTF-8 the way real Perl Encode behaves. - Register Encode::Encoding::mime_name in the runtime. - Store separate Name (Perl-canonical, e.g. "ascii", "utf-8-strict") and MimeName (IANA, e.g. "US-ASCII", "UTF-8") on the blessed object. - mime_name() returns MimeName (falling back to Name); name() returns Name unchanged. Result: jcpan -t HTTP::Response::Encoding now passes 18/18. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Java 21's Pattern.namedGroups() returns an ImmutableCollections.MapN which does not preserve insertion order. HashSpecialVariable was iterating that map's keySet() to group duplicate-named captures (e.g. (?<bar>a)(?<bar>b)), so the order in which alternatives were seen was effectively random — making `values %+` return the rightmost capture instead of Perl's leftmost. Sort each per-Perl-name list by group number (= source order) in both entrySet() and collectJavaNamesFor(). This restores the 3 regressed re/pat_advanced.t subtests (1317, 1320, 1321 in the "Test keys in %+ and %-" block) without affecting any other behavior. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Investigate and fix
jcpan -t HTTP::Response::Encoding.The test failed with:
HTTP::Message::content_charsetcallsIO::HTML::find_charset_in(..., {encoding=>1}), which returns anEncode::Encodingobject obtained fromEncode::find_encoding. PerlOnJava blesses these objects intoEncode::Encodingbut only registeredencode,decode, andnamemethods on that package —mime_namewas missing.A second failure,
expected 'ascii', got 'US-ASCII', came from$enc->namereturning the Java canonical charset name. Real PerlEncodereturns its own canonical names (e.g.ascii,utf-8-strict).Changes
Encode::Encoding::mime_name.Nameand an IANAMimeNameon the blessed encoding hash created byfind_encoding.name()returns the Perl-canonical name;mime_name()returns the IANA name (falling back toName).Test plan
make(full unit test suite passes)./jcpan -t HTTP::Response::Encoding→Result: PASS, 18/18 subtestsGenerated with Devin