views:

514

answers:

2

A week ago there was an interesting post on the PHP-Internals list:
http://marc.info/?l=php-internals&m=125842046913842&w=2

I've been thinking for a while what we should do about PHP6 and its future, because right now it seems like there isn't much future in it.

I started getting worried about the future of PHP6 quite a while before that. Except for some publishers in need of cash who brought us some PHP6 books, the past couple of years the entire PHP6 scene was rather quiet. Some of the top features of PHP6 were backported to PHP 5.3, but the main feature, Unicode support was not, and its questionable whether it ever will be. I feel this is really not a feature that should be missing from any modern programming language.

How are you dealing with the PHP Unicode situation now, and how are you planning on dealing with it in the future?

What's the most efficient and future proof way to handle Unicode strings nowadays in PHP 5.3?

+10  A: 

Unicode: http://php.net/manual/en/book.unicode.php

Internationalization: http://php.net/intl

That's how I deal with it now.

In order to deal with it in a future-proof manner you have to compile PHP with --enable-zend-multibyte and use declare().

It's worth noting that PHP6 will use UTF-16 internally.

Reference: http://www.php.net/manual/en/control-structures.declare.php#control-structures.declare.encoding

Flavius
I'd give +10 to this if I could! :)
o_O Tync
@o_O Tync I just 1+'d and made it +10 !
alex
Thank you alex, I had +1 in return this one, so it gets closer to 10 too: http://stackoverflow.com/questions/851140/best-way-to-format-pretty-urls-for-numeric-ids/851150#851150cheers
Flavius
+4  A: 

I won't focus too much on PHP 6 compatibility, yet. It will be some time till it comes out - if it is being released ever. In the PHP development team there isn't much energy going into PHP 6 and many developers don't really like some fundamental design decisions.

The best thing you can do is to try to stay to Utf-8 as encoding of your scripts and in-/ouput. When dealing with binary data you can spread in some (binary) casts which are equal to (string) in PHP 5. This won't fix some problems in PHP 6, like some functions expecting binary strings but you're passing Unicode Strings, but it makes adoption simpler.

But then again: I don't think a unicode PHP 6 will happen anytime soon.

johannes