Skip to content

Allow non-ascii chars in META.json - #744

Open
rsrchboy wants to merge 1 commit into
rjbs:mainfrom
rsrchboy:allow-utf8-meta.json
Open

Allow non-ascii chars in META.json#744
rsrchboy wants to merge 1 commit into
rjbs:mainfrom
rsrchboy:allow-utf8-meta.json

Conversation

@rsrchboy

@rsrchboy rsrchboy commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Forcing ascii here is causing explosions, e.g. when using ContributorsFromGit and someone happens to have a high-bit character in their name.

Forcing ascii here is causing explosions, e.g. when using
ContributorsFromGit and someone happens to have a high-bit character in
their name.
@Grinnz

Grinnz commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Can you elaborate? The ascii option to JSON encoders causes any non-ascii characters to be escaped in the output. This is done purposefully, as all-ASCII json files are much less likely to cause "explosions".

@rsrchboy

rsrchboy commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

Can you elaborate? The ascii option to JSON encoders causes any non-ascii characters to be escaped in the output.

Sure -- with this change, e.g. Dist::Zilla::Plugin::Git::CheckFor generates a META.json properly with, e.g.

   "x_contributors" : [
      "Christian Walde <walde.christian@googlemail.com>",
      "Karen Etheridge <ether@cpan.org>",
      "Mike Doherty <doherty@cs.dal.ca>",
      "Olivier Mengué <dolmen@cpan.org>"
   ],

Without it, I get:

/perl5/Dist/Zilla/Role/File.pm line 132.                                                                                                                                                        
; maybe you need the [Encoding] plugin to specify an encoding at /home/rsrchboy/perl5/lib/perl5/Dist/Zilla/Role/File.pm line 171.                                                               
        Dist::Zilla::Role::File::_throw(Dist::Zilla::File::FromCode=HASH(0x55abac97d388), "encode ascii", "\"\\x{00e9}\" does not map to ascii at /home/rsrchboy/perl5/lib/"...) called at /home
/rsrchboy/perl5/lib/perl5/Dist/Zilla/Role/File.pm line 133                                                                                                                                      
        Dist::Zilla::Role::File::catch {...} ("\"\\x{00e9}\" does not map to ascii at /home/rsrchboy/perl5/lib/"...) called at /usr/share/perl5/vendor_perl/Try/Tiny.pm line 123                
        Try::Tiny::try(CODE(0x55abae374c10), Try::Tiny::Catch=REF(0x55abaf152af8)) called at /home/rsrchboy/perl5/lib/perl5/Dist/Zilla/Role/File.pm line 133                                    
        Dist::Zilla::Role::File::_encode(Dist::Zilla::File::FromCode=HASH(0x55abac97d388), "{\x{a}   \"abstract\" : \"All Git::CheckFor plugins at once\",\x{a}   \"au"...) called at /home/rsrc
hboy/perl5/lib/perl5/Dist/Zilla/File/FromCode.pm line 98                                                                                                                                        
        Dist::Zilla::File::FromCode::encoded_content(Dist::Zilla::File::FromCode=HASH(0x55abac97d388)) called at /home/rsrchboy/perl5/lib/perl5/Dist/Zilla.pm line 749                          
        Dist::Zilla::_write_out_file(Dist::Zilla::Dist::Builder=HASH(0x55aba6c061b8), Dist::Zilla::File::FromCode=HASH(0x55abac97d388), Dist::Zilla::Path=ARRAY(0x55abaf13f530)) called at /home
/rsrchboy/perl5/lib/perl5/Dist/Zilla/Dist/Builder.pm line 375                                                                                                                                   
        Dist::Zilla::Dist::Builder::build_in(Dist::Zilla::Dist::Builder=HASH(0x55aba6c061b8), undef) called at /home/rsrchboy/perl5/lib/perl5/Dist/Zilla/Dist/Builder.pm line 424               
        Dist::Zilla::Dist::Builder::ensure_built_in(Dist::Zilla::Dist::Builder=HASH(0x55aba6c061b8)) called at /home/rsrchboy/perl5/lib/perl5/Dist/Zilla/Dist/Builder.pm line 413               
        Dist::Zilla::Dist::Builder::ensure_built(Dist::Zilla::Dist::Builder=HASH(0x55aba6c061b8)) called at /home/rsrchboy/perl5/lib/perl5/Dist/Zilla/Dist/Builder.pm line 491                  
        Dist::Zilla::Dist::Builder::build_archive(Dist::Zilla::Dist::Builder=HASH(0x55aba6c061b8)) called at /home/rsrchboy/perl5/lib/perl5/Dist/Zilla/App/Command/build.pm line 107            
        Dist::Zilla::App::Command::build::execute(Dist::Zilla::App::Command::build=HASH(0x55aba469de10), Getopt::Long::Descriptive::Opts::__OPT__::2=HASH(0x55aba4ba6da8), ARRAY(0x55aba460f988)
) called at /home/rsrchboy/perl5/lib/perl5/App/Cmd.pm line 473                                                                                                                                  
        App::Cmd::execute_command(Dist::Zilla::App=HASH(0x55aba41f05b0), Dist::Zilla::App::Command::build=HASH(0x55aba469de10), Getopt::Long::Descriptive::Opts::__OPT__::2=HASH(0x55aba4ba6da8)
) called at /home/rsrchboy/perl5/lib/perl5/App/Cmd.pm line 326                                                                                                                                  
        App::Cmd::run("Dist::Zilla::App") called at /home/rsrchboy/perl5/bin/dzil line 12

@karenetheridge

Copy link
Copy Markdown
Contributor

FWIW, this bug in [ContributorsFromGit] is why I created [Git::Contributors] ;)

@rsrchboy

rsrchboy commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

FWIW, this bug in [ContributorsFromGit] is why I created [Git::Contributors] ;)

Now you tell me :)

@karenetheridge

Copy link
Copy Markdown
Contributor

11 years ago! ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants