Closed benkasminbullock closed 7 years ago
Thanks you for report. Can you tell me please more details: perl -v perl -e 'use XML::Hash::XS; print $XML::Hash::XS::VERSION'
When I ran you script I got following message: utf8 "\x85" does not map to Unicode at /usr/lib64/perl5/vendor_perl/5.22.3/File/Slurper.pm line 59. Invalid XML at t.pl line 10. This is correctly because this module can't parse '<!DOCTYPE html>'. Unfortunately, such feature is not supported.
On 16 March 2017 at 04:13, Yuriy Ustushenko notifications@github.com wrote:
Thanks you for report. Can you tell me please more details: perl -v
$ perl -v
This is perl 5, version 18, subversion 2 (v5.18.2) built for i386-freebsd
Copyright 1987-2013, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page.
perl -e 'use XML::Hash::XS; print $XML::Hash::XS::VERSION'
$ perl -e 'use XML::Hash::XS; print $XML::Hash::XS::VERSION' 0.48
When I ran you script I got following message: utf8 "\x85" does not map to Unicode at /usr/lib64/perl5/vendor_perl/5.22.3/File/Slurper.pm line 59. Invalid XML at t.pl line 10.
0x85 is never valid as UTF-8 so that error indicates that your file is corrupted. There is no byte in the Card_diamond.svg file with the value 0x85:
$ hexdump Card_diamond.svg | grep 85 0000850 3533 3032 2c38 3631 362e 3339 3231 2d20
This only matches the offset 000850 at the beginning of the line. The file I used I obtained like this:
wget https://upload.wikimedia.org/wikipedia/en/1/1f/Card_diamond.svg
This is correctly because this module can't parse ''. Unfortunately, such feature is not supported.
The above error comes from File::Slurper, not your module, so your module cannot be said to be behaving correctly.
The correct encoding is "utf-8" instead of "utf8", it was a mistake in the documentation. There was also a problem with the encoder error handler, when encoding is incorrect it fails. Please check this with version 0.50.
I have downloaded XML::Hash::XS 0.50 from CPAN and confirmed that this error no longer occurs.
On 17 March 2017 at 03:54, Yuriy Ustushenko notifications@github.com wrote:
The correct encoding is "utf-8" instead of "utf8", it was a mistake in the documentation. There was also a problem with the encoder error handler, when encoding is incorrect it fails. Please check this with version 0.50.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/yoreek/XML-Hash-XS/issues/10#issuecomment-287157171, or mute the thread https://github.com/notifications/unsubscribe-auth/AAGOdTyHEGqH1FA8rcAsetKtqVJ8jp8qks5rmYV3gaJpZM4Mdiva .
Ok, thanks.
When I ran the module like this:
it crashed with segmentation fault error.
The input file is this:
https://upload.wikimedia.org/wikipedia/en/1/1f/Card_diamond.svg
The backtrace looks like this:
(gdb) bt
0 0x282a804b in free () from /lib/libc.so.7
1 0x2918b9dc in libiconv_close () from /usr/local/lib/libiconv.so.2
2 0x2839659d in xh_encoder_create ()
from /home/ben/software/install/lib/perl5/site_perl/5.18.2/i386-freebsd/auto/XML/Hash/XS/XS.so
3 0x2839da04 in xh_common_reader_switch_encoding ()
from /home/ben/software/install/lib/perl5/site_perl/5.18.2/i386-freebsd/auto/XML/Hash/XS/XS.so
4 0x2839d24e in xh_string_reader_switch_encoding ()
from /home/ben/software/install/lib/perl5/site_perl/5.18.2/i386-freebsd/auto/XML/Hash/XS/XS.so
5 0x2839d1e2 in xh_string_reader_init ()
from /home/ben/software/install/lib/perl5/site_perl/5.18.2/i386-freebsd/auto/XML/Hash/XS/XS.so
6 0x2839d124 in xh_reader_init ()
from /home/ben/software/install/lib/perl5/site_perl/5.18.2/i386-freebsd/auto/XML/Hash/XS/XS.so
7 0x2839e8ff in xh_x2h ()
from /home/ben/software/install/lib/perl5/site_perl/5.18.2/i386-freebsd/auto/XML/Hash/XS/XS.so
8 0x28394518 in XS_XMLHashXS_xml2hash ()
from /home/ben/software/install/lib/perl5/site_perl/5.18.2/i386-freebsd/auto/XML/Hash/XS/XS.so ---Type to continue, or q to quit---
9 0x080ea59f in Perl_pp_entersub ()
10 0x080e40f3 in Perl_runops_standard ()
11 0x0807d61d in perl_run ()
12 0x0806368d in main ()
This is probably a user error in my program, I have not read the documentation for the module and was just trying it out, but regardless of that, it should not segmentation fault like this. The same thing happened with every XML file I tried.