Handling non-English letters in PHP

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Phil Powell

    Handling non-English letters in PHP

    I need to store data into XML that, often enough, is not in English. How
    have you guys dealt with characters not found in the English language like ä
    or é or å? I have to store them as "å" in my XML file, however,
    whenever I am doing evaluation somehow the "å" gets converted literally
    to "å" and when that displays in HTML it chokes, puts garbage BACK into the
    XML file and it deteriorates further.

    How can I ensure that when going back and forth between HTML, PHP and XML
    that "å" REMAINS "å" AS IS???

    Thanx
    Phil


  • Leslie Hoare

    #2
    Re: Handling non-English letters in PHP


    "Phil Powell" <soazine@erols. com> wrote in message
    news:Tdh5b.9639 1$xf.35294@lake read04...[color=blue]
    > I need to store data into XML that, often enough, is not in English. How
    > have you guys dealt with characters not found in the English language like[/color]
    ä[color=blue]
    > or é or å? I have to store them as "&#229;" in my XML file, however,
    > whenever I am doing evaluation somehow the "&#229;" gets converted[/color]
    literally[color=blue]
    > to "å" and when that displays in HTML it chokes, puts garbage BACK into[/color]
    the[color=blue]
    > XML file and it deteriorates further.
    >
    > How can I ensure that when going back and forth between HTML, PHP and XML
    > that "&#229;" REMAINS "&#229;" AS IS???
    >
    > Thanx
    > Phil
    >[/color]

    Try encoding it as UTF-8 instead of converting to entities.


    Leslie


    Comment

    • Nikolai Chuvakhin

      #3
      Re: Handling non-English letters in PHP

      "Phil Powell" <soazine@erols. com> wrote
      in message news:<Tdh5b.963 91$xf.35294@lak eread04>...[color=blue]
      >
      > I need to store data into XML that, often enough, is not in English.
      > How have you guys dealt with characters not found in the English
      > language like ä or é or å?[/color]

      The XML specification says,

      Each external parsed entity in an XML document may use a different
      encoding for its characters. All XML processors must be able to read
      entities in both the UTF-8 and UTF-16 encodings.



      which I take to mean that if you want to store non-Latin characters,
      your best bet is to do it in UTF-16 encoding...

      Cheers,
      NC

      Comment

      Working...