Encoding problem

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

    #1

    Encoding problem

    Hi there i have a problem while parsing and xml file.
    The file is a backup from moodle (moodle.xml). When i open the file
    with one of my editors
    and setting Encoding to utf8 font courier standard or greek characters
    the editor can see all greek strings contained within the file
    perfectly. On the other hand when i try to open it with php
    parse it and then display it on a web page the data from the file come
    out like latin characters like (A~ atilde)(o: o umplaud) and others
    like this. Updating moodle is not an option so i have to find a
    workaround. Has anybody heard of something like this? thanks in advance

  • Juliette

    #2
    Re: Encoding problem

    imoschak wrote:
    Hi there i have a problem while parsing and xml file.
    The file is a backup from moodle (moodle.xml). When i open the file
    with one of my editors
    and setting Encoding to utf8 font courier standard or greek characters
    the editor can see all greek strings contained within the file
    perfectly. On the other hand when i try to open it with php
    parse it and then display it on a web page the data from the file come
    out like latin characters like (A~ atilde)(o: o umplaud) and others
    like this. Updating moodle is not an option so i have to find a
    workaround. Has anybody heard of something like this? thanks in advance
    >
    The encoding which is send in the headers is probably latin which would
    cause the faulty display.
    Have a look at moodle to see if you can set the page encoding in the
    configuration or something.

    Comment

    • imoschak

      #3
      Re: Encoding problem


      Juliette wrote:
      imoschak wrote:
      Hi there i have a problem while parsing and xml file.
      The file is a backup from moodle (moodle.xml). When i open the file
      with one of my editors
      and setting Encoding to utf8 font courier standard or greek characters
      the editor can see all greek strings contained within the file
      perfectly. On the other hand when i try to open it with php
      parse it and then display it on a web page the data from the file come
      out like latin characters like (A~ atilde)(o: o umplaud) and others
      like this. Updating moodle is not an option so i have to find a
      workaround. Has anybody heard of something like this? thanks in advance
      >
      The encoding which is send in the headers is probably latin which would
      cause the faulty display.
      Have a look at moodle to see if you can set the page encoding in the
      configuration or something.
      The encoding in the meta tags is set to utf-8 plus the data from the
      xml file is printed out by a page that i created not by moodle. And in
      the editor if i set the font to courier ANSI characters the editor
      prints out exactly the same latin characters as the broswer (sorry i
      forgot this:-)

      Comment

      • Juliette

        #4
        Re: Encoding problem

        imoschak wrote:
        Juliette wrote:
        >imoschak wrote:
        >>Hi there i have a problem while parsing and xml file.
        >>The file is a backup from moodle (moodle.xml). When i open the file
        >>with one of my editors
        >>and setting Encoding to utf8 font courier standard or greek characters
        >>the editor can see all greek strings contained within the file
        >>perfectly. On the other hand when i try to open it with php
        >>parse it and then display it on a web page the data from the file come
        >>out like latin characters like (A~ atilde)(o: o umplaud) and others
        >>like this. Updating moodle is not an option so i have to find a
        >>workaround. Has anybody heard of something like this? thanks in advance
        >>>
        >The encoding which is send in the headers is probably latin which would
        >cause the faulty display.
        >Have a look at moodle to see if you can set the page encoding in the
        >configuratio n or something.
        >
        The encoding in the meta tags is set to utf-8 plus the data from the
        xml file is printed out by a page that i created not by moodle. And in
        the editor if i set the font to courier ANSI characters the editor
        prints out exactly the same latin characters as the broswer (sorry i
        forgot this:-)
        >
        Meta tag setting is not the important one, the important one is the
        header you send.

        In php that would be:
        header('Content-Type: text/html; charset=utf-8' );

        Comment

        • Rik

          #5
          Re: Encoding problem

          Juliette wrote:
          imoschak wrote:
          >Juliette wrote:
          >>imoschak wrote:
          >>>Hi there i have a problem while parsing and xml file.
          >>>The file is a backup from moodle (moodle.xml). When i open the file
          >>>with one of my editors
          >>>and setting Encoding to utf8 font courier standard or greek
          >>>characters the editor can see all greek strings contained within
          >>>the file perfectly. On the other hand when i try to open it with
          >>>php
          >>>parse it and then display it on a web page the data from the file
          >>>come out like latin characters like (A~ atilde)(o: o umplaud) and
          >>>others like this. Updating moodle is not an option so i have to
          >>>find a workaround. Has anybody heard of something like this?
          >>>thanks in advance
          >>>>
          >>The encoding which is send in the headers is probably latin which
          >>would cause the faulty display.
          >>Have a look at moodle to see if you can set the page encoding in the
          >>configurati on or something.
          >>
          >The encoding in the meta tags is set to utf-8 plus the data from the
          >xml file is printed out by a page that i created not by moodle. And
          >in the editor if i set the font to courier ANSI characters the editor
          >prints out exactly the same latin characters as the broswer (sorry i
          >forgot this:-)
          >>
          >
          Meta tag setting is not the important one, the important one is the
          header you send.
          >
          In php that would be:
          header('Content-Type: text/html; charset=utf-8' );
          Yup, that was pointed out to me recently. And very logical too: as soon as a
          program 'reads' the meta-tag, it has already chosen a charset and any hint
          what it should be in the authors opinion in the meta tag is too late.

          Grtz,
          --
          Rik Wasmus


          Comment

          Working...