° is not handle the same as &qout; html5 vs flash

  • Hi,

    I'm hitting a slight problem with degrees symbols in my XML.

    My XML is being created dynamically using PHP, and of course there are certain strings which I must sanitise with PHP before writing to the XML to ensure that the XML is valid.

    I've noticed something weird with the way ° is handled... Let me explain:

    In PHP I have a function which returns this:

    Code
    return $hemisphere . $degrees . '° ' . $minutes . ''' . ' ' . $seconds . '"';

    Which will give me something like: "S23° 20' 27.49""
    This looks to me ready for the XML. So maybe I can use this in the XML without running through my escape string?
    Firefox really hates the ° in the XML. So I thought I'd run the whole thing again through my escape function.
    Which will give me:

    "S23° 20' 27.49""


    With Flash: KRPano will display this to me on my viewer as: S23° 20' 27.49" (notice that the &amp:def; turned into ° but &apos turned into ')
    With HTML5 on firefox it displays as: S23° 20' 27.49"

    Google chrome does the same.

    I'm wondering if there is a reason for this or if it might be a bug somewhere?

    In the meantime I'll put in a special case to let KRPano test for html5 in the XML

    David

  • Hi,

    But I'm still wondering why ° is special.

    ° (and many other &XXX; tags) is not XML-conform (without explicit definition)

    See here:
    http://en.wikipedia.org/wiki/List_of_X…tity_references
    http://xml.silmaril.ie/specials.html

    That means by default there are only 5 xml entities that can be used in a xml.

    To avoid XML parsing and allow all characters and entities put that code part into CDATA tags - e.g. see here:
    https://krpano.com/docu/xml/#data

    Regarding Flash and HTML5 - the XML parser of the Flashplayer isn't very strict, it allows several invalid xml codes without parser error, but the HTML5 browsers are very strict here - they require valid xml files.

    Best regards,
    Klaus

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!