Ben Morrow <> wrote:
> Quoth (Fergus McMenemie):
> > Hi, I have been driven mad by the following, which took ages to track
> > down. What is going on? I appears it is invalid to use toString on the
> > document object.
> >
> >
> > #! /usr/local/bin/perl -w
> > use strict;
> > use warnings;
> > use utf8;
> > use Encode;
> > use XML::LibXML;
> > binmode(STDOUT, ":utf8");
> >
> > my $src= join("",<DATA>);
> > print "string \$src is invalid \n" unless ( Encode::is_utf8($src,1) );
>
> Don't do that. Encode::is_utf8 checks the state of the SvUTF8 flag,
> which is internal to perl and none of your business. (The Encode
> documentation is not as clear about this as is might be, because it only
> became clear through experience that this is the only approach which
> works.)
Agreed, the warnings are there. However it did appear to make the
issue clearer. This example is rather goofy and posting it to USEnet
added a few more wrinkles. My original code and the real program
contained the actual characters. However my USEnet reader would not
let me post the real chars. Hence the octets.
My issue is that document->toString does not appear to work. Please
ignore the use of us_utf8.
> What are you actually trying to find out?
I have to pass references to DOM objects around all over the
place. I find I am having to make use of either documentElement()
or ownerDocument() depending on what I am doing. I would like to have
a consistent "pattern" for doing this. I would like to setting on
passing the document object around but it is anoying that I cant then
use toString.