Langauge Issue with DOM

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

    Langauge Issue with DOM

    Hi,

    I want to display some germen text in my site.
    and it is coming well when i have given content="text/html;
    charset=utf-8" in meta Tag

    But when i takes some data (as HTML) from server through AJAX and
    insert it into a Div using innerHTML property,the characters are not
    displaying well

    Please help to find some solution

    Regards,
    Anees
  • GArlington

    #2
    Re: Langauge Issue with DOM

    On Feb 22, 1:48 pm, Anees <muhd.an...@gma il.comwrote:
    Hi,
    >
    I want to display some germen text in my site.
    and it is coming well when i have given content="text/html;
    charset=utf-8" in meta Tag
    >
    But when i takes some data (as HTML) from server through AJAX and
    insert it into a Div using innerHTML property,the characters are not
    displaying well
    >
    Please help to find some solution
    >
    Regards,
    Anees
    The page answering AJAX call should specify charset too...

    Comment

    • Martin Honnen

      #3
      Re: Langauge Issue with DOM

      Anees wrote:
      But when i takes some data (as HTML) from server through AJAX and
      insert it into a Div using innerHTML property,the characters are not
      displaying well
      Make sure your server-side code sends a HTTP Content-Type header with a
      proper charset parameter e.g.
      Content-Type: text/plain; charset=UTF-8
      The charset parameter value to use depends entirely on how the data is
      encoded, UTF-8 is just an example.


      --

      Martin Honnen

      Comment

      • Anees

        #4
        Re: Langauge Issue with DOM

        Make sure your server-side code sends a HTTP Content-Type header with a
        proper charset parameter e.g.
        Content-Type: text/plain; charset=UTF-8
        I have added the line

        header("Content-type: text/html; charset=UTF-8");

        in my PHP server side file..
        but still am not getting the characters right!!!

        Comment

        • SAM

          #5
          Re: Langauge Issue with DOM

          Anees a écrit :
          Hi,
          >
          I want to display some germen text in my site.
          and it is coming well when i have given content="text/html;
          charset=utf-8" in meta Tag
          >
          But when i takes some data (as HTML) from server through AJAX and
          insert it into a Div using innerHTML property,the characters are not
          displaying well
          In what charset are your html datas encoded ?

          With which browser(s) does that happens ?

          With my tries about Ajax on a server that does'nt send charset headers
          I use only files written (coded ?) in utf-8

          I have same problem as yours with files in utf-8 only with Safari which
          wants absolutely to read them in iso-8859-1.
          For him I inserts the xml declaration on top of files to call :
          <?xml version="1.0" encoding="utf-8"?>
          and that seems to fix the question.


          --
          sm

          Comment

          • Anees

            #6
            Re: Langauge Issue with DOM

            With my tries about Ajax on a server that does'nt send charset headers
            I use only files written (coded ?) in utf-8

            First i have set the header in the to of PHP action file
            header("Content-type: text/html; charset=UTF-8");
            but it doesnt take any effect

            Then i removed it and i converted all my data with
            utf8_encode($ge rm_data);
            Now it is working well..
            I have same problem as yours with files in utf-8 only with Safari which
            wants absolutely to read them in iso-8859-1.
            For him I inserts the xml declaration on top of files to call :
            <?xml version="1.0" encoding="utf-8"?>
            and that seems to fix the question.
            i am just getting whole the data from the server with responseText
            and keeping all the data in a DIV with InnerHTML property..
            So does i need to go for
            <?xml version="1.0" encoding="utf-8"?>
            in the page top?

            Comment

            Working...