#!/usr/bin/perl
use warnings;
use strict;
use feature qw{ say };
use XML::LibXML;
for my $file (qw( 1%3Ab.xml 1:b.xml )) {
open my $out, '>', $file or die "$file: $!";
print {$out} "<r>$file</r>";
close $out;
my $dom = 'XML::LibXML'->load_xml(location => $file);
say $dom->URI;
unlink $file;
}
This returns:
The problem lies in the underlying libxml2 library, see Filenames starting with a digit are stored percent encoded in xmlDoc.URL.
The upstream isn't going to fix the bug, but maybe we can workaround it in XML::LibXML? I haven't investigated whether it's possible, yet.