UTF-8 fwrite problem

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

    UTF-8 fwrite problem

    Hey,

    I've got a problem with utf-8 strings.

    I start with getting a string from a database and when i encode it
    with
    utf8Encode($str ) and output it to the browser (which has a utf-8
    encodig), there is no problem displaying special symbols (like the
    euro sign €).

    But then i want to creat an xml document and write the following to a
    file:

    <?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"ye s\"?>
    <Root>
    utf8Encode($str )
    </Root>


    But when i open the xml file the special symbols are gone :-S.
    I've tried a lot, but can't get it working.

    So please help!

    BTW: I'm using server with this phpinfo:

  • Daniel Tryba

    #2
    Re: UTF-8 fwrite problem

    AngTalunin <wslob84@gmail. com> wrote:[color=blue]
    > I start with getting a string from a database and when i encode it
    > with
    > utf8Encode($str ) and output it to the browser (which has a utf-8
    > encodig), there is no problem displaying special symbols (like the
    > euro sign ?).[/color]

    That is strange... According to the manual it translates an iso8859-1
    string to UTF-8. And iso8859-1 doesn't have an euro symbol. Just like
    the euro symbol is missing in the charset you posted this in, the ?
    above is a \200 char which is illegal in iso8859-1
    [color=blue]
    > But then i want to creat an xml document and write the following to a
    > file:
    >
    > <?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"ye s\"?>
    > <Root>
    > utf8Encode($str )
    > </Root>[/color]

    Please post an URL to an example. My gues is that the http headers
    (which have priority) set the encoding to something else.
    [color=blue]
    > BTW: I'm using server with this phpinfo:
    > http://www.wijkkrant.nl/m_export_xml/info.php[/color]

    It appears that iconv is installed, sadly enough mstring is missing
    (modules aren't loaded it seems).

    Comment

    Working...