Hello.

I keep getting segfaults when I attempt to parse an XML with Czech diacritic characters encoded in UTF-8. I experienced this no matter what parser package I used, except for PurePerl. The segfault only happens for XML files above 2 KB or so... I'm including the code that causes the fault and a link to the minimal XML file giving me the error (if I delete a line, it runs normally).

This has been happening since July roughly and I've been solving it by using PurePerl which now seems to have a bug in it, so I decided to ask help on this matter first.

My perl and machine are: v5.8.8 built for x86_64-linux-thread-multi
Gentoo Linux for amd64 on Core2 Duo, Kernel 2.6.19 with Gentoo patches.

The XML file

#!/usr/bin/perl { package Handler; use strict; use warnings; use encoding 'utf8'; sub new { bless +{} } } use strict; use warnings; use encoding 'utf8'; use XML::SAX::ParserFactory; $XML::SAX::ParserPackage = "XML::LibXML::SAX"; open (my $file, '<:encoding(utf8)', 'train.m.xml'); my $parser = XML::SAX::ParserFactory->parser( "Handler" => Handler->new() ); $parser->parse_file($file);

In reply to XML::SAX UTF-8 segfault by Sixtease

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.