Encoding problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rutger Claes

    Encoding problem

    I have a dom tree representing the content of a html document. In the xml I
    use € as the euro sign. I think I need to do this to be able to use
    xsl transformations . After the xsl transformation I use a small SAX
    parser. But my € gets converted to: â,¬50.
    I've tried passing xml_parser_crea te() 'UTF-8' and '' (hint from php.net)
    but it only makes things worse ( ? or squares are displayed ).
    How do i have to encode characters to be able to pass them to SAX. Is there
    a build in function or do I use str_replace()?

    Rutger Claes
    --
    Rutger Claes rgc@rgc.tld
    Replace tld with top level domain of belgium to contact me pgp:0x3B7D6BD6
    The soul would have no rainbow had the eyes no tears.

  • Jason Morehouse

    #2
    Re: Encoding problem

    Rutger Claes wrote:[color=blue]
    > I have a dom tree representing the content of a html document. In the xml I
    > use € as the euro sign. I think I need to do this to be able to use
    > xsl transformations . After the xsl transformation I use a small SAX
    > parser. But my € gets converted to: â,¬50.
    > I've tried passing xml_parser_crea te() 'UTF-8' and '' (hint from php.net)
    > but it only makes things worse ( ? or squares are displayed ).
    > How do i have to encode characters to be able to pass them to SAX. Is there
    > a build in function or do I use str_replace()?
    >
    > Rutger Claes[/color]

    Why not just use € ?

    --
    Jason Morehouse
    Vendorama - The evolution of e-commerce

    Comment

    • Daniel Tryba

      #3
      Re: Encoding problem

      Jason Morehouse <jm@rm.spam-vendorama.com> wrote:[color=blue][color=green]
      >> I have a dom tree representing the content of a html document. In the xml I
      >> use &#x20AC; as the euro sign.[/color]
      >
      > Why not just use &euro; ?
      >[/color]

      That is not one of the 5 default character entities in XML. It's only
      valid when defined in a DTD.

      No direct answer to the OPs question, but if the encoding of the XML is
      either iso-8859-15 or UTF-x there is no need to encode the EUR symbol.

      Comment

      • Rutger Claes

        #4
        Re: Encoding problem

        Daniel Tryba wrote:
        [color=blue]
        > Jason Morehouse <jm@rm.spam-vendorama.com> wrote:[color=green][color=darkred]
        >>> I have a dom tree representing the content of a html document. In the
        >>> xml I use &#x20AC; as the euro sign.[/color]
        >>
        >> Why not just use &euro; ?
        >>[/color]
        >
        > That is not one of the 5 default character entities in XML. It's only
        > valid when defined in a DTD.
        >
        > No direct answer to the OPs question, but if the encoding of the XML is
        > either iso-8859-15 or UTF-x there is no need to encode the EUR symbol.[/color]

        It's not really important what encoding I will use.  It's just that if I
        don't use &#x20AC; I get errors from my XSL transformation.
        I just need a way to get through XSL and then through SAX.  If I can use the
        same symbol, great.  If I have to do a str_replace then I just need to know
        from &#x20AC; to what...

        Can I use a <?xml encoding="" ?> or something in my XSL transformation so
        that I can use another symbol then &#x20AC; that is also usable in SAX.

         Thanks for the answers, sorry for the english
         
          Rutger Claes
        --
        Rutger Claes rgc@rgc.tld
        Replace tld with top level domain of belgium to contact me pgp:0x3B7D6BD6
        Computers are useless. They can only give you answers.
        -- Pablo Picasso

        Comment

        Working...