Posted by J2be on 03/29/06 14:35
"julian_m" <julianmaisano@gmail.com> wrote in message
news:1143622326.766053.310820@z34g2000cwc.googlegroups.com...
>I've a problem related charset (I think)
>I think that my problem is related to these two lines:
>
>header('Content-Type: text/xml');
>print '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
>Can anyone give me a hint?
>
>Note that the table is defined as
>"ENGINE=MyISAM DEFAULT CHARSET=latin1;"
You've to convert the string from the charset latin1 to UTF-8
if you want to send data as UTF-8
because by sending
header('Content-Type: text/xml');
print '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
you just tell to the browser that the strings are UTF-8 while they are not.
you should use iconv() to convert from a charset to another
http://www.php.net/iconv
-------------------------------------
header('Content-Type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
echo iconv("ISO-8859-1","UTF-8",$stringfromsqldatabase);
-------------------------------------
(ISO-8859-1 is latin1)
To manage UTF-8 (or other multibyte) strings use mbstring functions.
Regards.
--
Leonardo Armando Iarrusso - J2Be
www: http://www.J2be.com - e-mail: info[at]J2Be.com
Navigation:
[Reply to this message]
|