Re: PHP support of Unicode?
| From: | Darren Cook | Date: | Thu, 08 Oct 2009 02:32:57 +0000 |
| Subject: | Re: PHP support of Unicode? | ||
| References: | 1 | Groups: | php.i18n |
| Request: | Send a blank email to php-i18n+get-1330@lists.php.net to get a copy of this message | ||
> encoding. But using PHP with other languages, is that possible? I
> mean, does PHP support Unicode at present time?
Yes, PHP is an excellent choice for unicode work, both for websites and
commandline utilities.
> As I understand it, the following statement is true: "PHP supports
> Unicode only as long as it is encoded as UTF-8"
UTF-8 is usually what you want. Browser and tool and editor support is
most widespread for UTF-8 (especially on linux).
Even using a Microsoft SQL Server database, which I believe was using
UCS-2LE internally, I give it the data in UTF-8, and the database
connection handles the conversion behind the scenes for me.
Be aware if you go down the UTF-16 route you have to start caring about
LE vs. BE, and also need to understand the difference between UTF-16 and
UCS-2.
> Is that correct, or does PHP also support UTF-16?
If using the mbstring extension then UTF-16 is supported (including for
regexes apparently):
http://jp.php.net/manual/en/mbstring.supported-encodings.php
mbstring has been on all shared hosts I've used, so it is usually fine
to rely on it.
Darren
--
Darren Cook, Software Researcher/Developer
http://dcook.org/gobet/ (Shodan Go Bet - who will win?)
http://dcook.org/mlsn/ (Multilingual open source semantic
network)
http://dcook.org/work/ (About me and my work)
http://dcook.org/blogs.html (My blogs and articles)