Here's a simple PHP function i created to process MySQL query results
into a format that was compatible with being used in an XML file:
function encodedString($unencodedString){
$string=htmlspecialchars($unencodedString);
$string=utf8_encode($string);
return $string;
}
Check out the PHP documentaion:
http://uk3.php.net/manual/en/function.htmlspecialchars.php
<quote>
Certain characters have special significance in HTML, and should be
represented by HTML entities if they are to preserve their meanings.
This function returns a string with some of these conversions made;
the translations made are those most useful for everyday web
programming. If you require all HTML character entities to be
translated, use htmlentities() instead.
</quote>
And the documentation for htmlentities() states:
<quote>
This function is identical to htmlspecialchars() in all ways, except
with htmlentities(), all characters which have HTML character entity
equivalents are translated into these entities.
</quote>
(http://uk3.php.net/manual/en/function.htmlentities.php)
Martin.
On 25 Sep, 09:15, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> On Sep 25, 1:02 am, komsi <[EMAIL PROTECTED]> wrote:
>
> > Yes now i get the same message...
> > It seems to be quite hard to come through this problem :-(
>
> Do you understand what that message means?
>
> It means there is a "Ã" in your xml (it hasn't been double
> encoded...) so your xml is not valid, therefore the parser fails.
>
> Changing the character encoding of the page will not fix encoded
> entities. (It won't change à back to the appropriate character,
> you have to do that in your database).
>
> -- Larry
>
>
>
> > On 24 Sep., 23:55, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> > wrote:
>
> > > On Sep 24, 2:34 pm, komsi <[EMAIL PROTECTED]> wrote:
>
> > > > I have used $newnode->setAttribute("name",
> > > > utf8_encode(utf8_encode($row['name'])));
> > > > but now i get nothing here :http://www.micmus.dk/phpsqlajax_genxml.php
>
> > > I get the message below:
>
> > > The XML page cannot be displayed
> > > Cannot view XML input using XSL style sheet. Please correct the error
> > > and then click the Refresh button, or try again later.
> > > ---------------------------------------------------------------------------
> > > -----
> > > Reference to undefined entity 'Atilde'. Error processing resource
> > > 'http://www.micmus.dk/phpsqlajax_genxml.php'. Line 1, Po...
> > > <markers><marker name="Pan Africa Market" address="dfhgddgadfgagaga"
> > > lat="47.608940" lng="-122.340141" type="restau...
>
> > > > On 24 Sep., 23:10, "warden [Andrew Leach - Maps API Guru]"
>
> > > > <[EMAIL PROTECTED]> wrote:
> > > > > On Sep 24, 10:03 pm, komsi <[EMAIL PROTECTED]> wrote:
>
> > > > > > Yes i know, but how can i do that in my phpsqlajax_genxml.php
> > > > > > file.. ??
>
> > > > > If this encodes once:
> > > > > $newnode->setAttribute("name", utf8_encode($row['name']));
> > > > > this encodes twice:
> > > > > $newnode->setAttribute("name",
> > > > > utf8_encode(utf8_encode($row['name'])));
>
> > > > > Doing that will mean that a character like & -- which needs to be
> > > > > encoded as & -- will actually end up as &amp;. That will be
> > > > > interpreted correctly in exactly the way that &oslash; is.
>
> > > > > Andrew- Hide quoted text -
>
> > > > - Show quoted text -- Skjul tekst i anførselstegn -
>
> > > - Vis tekst i anførselstegn -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---