Re: Problem with appendChild and ellipsis... [message #173078 is a reply to message #173077] |
Sun, 20 March 2011 19:25 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 3/20/2011 2:24 PM, Dennis wrote:
> <?php
>
> foo();
> echo "test done<br>";
> exit;
>
> function foo()
> {
> $doc = new DOMDocument();
> $doc->formatOutput = true;
>
> $title = $doc->createElement("title");
> $doc->appendChild($title);
>
> $title_data = "Some data followed by an ellipses…";
>
> $title_text = $doc->createTextNode($title_data);
> $title->appendChild($title_text);
>
> $doc->saveXML();
> $doc->save("test.xml");
>
> echo "foo done<br>";
> }
>
> ?>
OK, running your code I get the following messages:
Warning: DOMDocument::saveXML(): string is not in UTF-8 in
C:\temp\domdoctest.php on line 20
Warning: DOMDocument::save(): string is not in UTF-8 in C:\temp
\domdoctest.php on line 21
Your problem is that the character you are using has no UTF-8
equivalent. You can't use characters not in the current charset.
Whenever I need ellipses I just use three periods (...).
BTW - if you had display_errors=on and error_reporting=E_ALL in your
php.ini file you would have seen these messages. I highly recommend
they be enabled on all development systems (but not production).
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|