You are here: Re: Foreign languages and PHP « PHP Programming Language « IT news, forums, messages
Re: Foreign languages and PHP

Posted by Pedro Graca on 10/10/06 22:17

JoeT wrote:
> Problem is that the spanish words contain characters that are spanish
> specific, and when I read them in, they are converted into '?'.
>
> I don't want this.
> Any suggestions as to how to get around this?

Use the same character set for input and output.
If you got them as iso-8859-1 output them as iso-8859-1 (or convert)
If you got them as utf-8 output utf-8 (or convert)



<?php
$charsets = array('iso-8859', 'utf-8', 'us-ascii', 'iso-2022-jp', 'koi8-r');
$charset = $charsets[array_rand($charsets)];

header('Content-Type: text/plain; charset=' . $charset);

echo "Example of $charset\n\n\n";
for ($i=0; $i<16; ++$i) {
echo dechex($i), " :: ";
for ($j=0; $j<16; ++$j) {
echo chr($i*16 + $j);
}
echo "\n";
}
?>


Q: Why does my browser want to download this script when $charset is
"iso-8859-1"? (That is why I reverted to "iso-8859" in the script).

--
File not found: (R)esume, (R)etry, (R)erun, (R)eturn, (R)eboot

 

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

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