You are here: Re: charsert question « PHP Programming Language « IT news, forums, messages
Re: charsert question

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация