I attended the SF PHP Meetup last night where Andrei Zmievski (PHP 6 release manager and PHP core team member) gave a talk on PHP 6 and internationalization (i18n).  It was good to hear that while PHP 6 has been in development for the past 2 years, it's very likely that we'll be seeing a release in early 2009, and definitely ahead of Perl 6, as Andrei joked.

The main feature of PHP 6 will be that it will be entirely Unicode supported.  Or as one of his slides so aptly stated:

PHP 6 = PHP 5 + Unicode

It was evident that Andrei and team have given quite a bit of thought into what i18n means for the PHP world, and as a result, PHP developers everywhere will soon be enjoying a new set of tools to enable faster development of multi-lingual sites.  My favorite example was a class that had the method names all defined using different languages, including an example in Hebrew (written right to left)!  From a practical standpoint, many of the features are intelligent enough to be able to handle common cultural issues such as proper sorting and date/number formatting.

The even better news is that most of these features will also be available for the upcoming PHP 5.3 release via pecl.  The intl module will be "backwards" compatible with PHP 5.3 since the classes expect UTF-8 encodings.  How you provide those strings is up to the you.

One concern about PHP 6 is that since it will be entirely Unicode, strings will automatically double in size, meaning there will certainly be a performance hit.  So for now, I look forward to i18n with PHP 5.3 as well as the much needed namespaces.

Andrei's presentation is available on his site here.

Comments:

Whether strings will grow with Unicode support really depends on the implementation.

Uf PHP6 will use UTF-8, then no, all strings will have exactly the same length as they have now. UTF-8 is directly backwards-compatible with US-ASCII, so is generally preferred as the industry standard encoding for Unicode.

UTF-8 characters can consist of any number of bytes (from 1 to 5, I believe is the current maximum supported by major implementations), so unless you type lots of Hebrew or Japanese Kana or Ancient Phoenician, your strings will remain the same size as always. :)

- Simon

Posted by Simon on July 13, 2008 at 07:19 AM PDT #

But will it support astral characters?

Unicode has 17 "planes", each with 65,536 characters. Most software that claims to support Unicode, even using terms like "full Unicode support", only supports characters from plane 0, the Basic Multilingual Plane. The "astral" characters are those from planes 1 through 16.

And how well is PHP going to hide its implementation details? Will trying to get the length of a string tell you how many characters are in the string, or will it do like most languages and instead tell you how many 8-bit (UTF-8) or 16-bit (UTF-16) units are used to encode those characters?

It's great that PHP is increasing it support for Unicode, but most likely there will still be a very very long way to go after PHP 6.

Posted by James Justin Harrell on July 13, 2008 at 09:43 AM PDT #

Good performance, bytes, codepoints, graphemes and characters ... IMHO Parrot and Perl 6 are designed with real Unicode support.

Posted by mj on July 13, 2008 at 10:29 AM PDT #

James,

PHP 6 supports all the planes, fully and transparently. strlen() and all similar functions operate on codepoints (not codeunits or bytes), so you will get the correct result back.

Simon,

PHP 6 uses UTF-16 internally.

Posted by Andrei Z on July 17, 2008 at 09:48 AM PDT #

Um, I think this page has been hacked - it tried to phish for my Twitter credentials.

Posted by Eric on January 08, 2009 at 02:39 PM PST #

I have a question.

How do you get the size of the string in PHP 6 if strlen() returns the count of characters?

Let's say: $data = file_get_contents('...any file...');
echo strlen($data); // will it return the siz eof the file any longer?

I know I could use filesize(), but there are many cases when you don't deal with files, but binary data. Are there any problems with that in case of strlen()?

Thanks!

Posted by Kai on June 11, 2009 at 08:45 AM PDT #

Keep up the good work bro.Your article is really great and I truly enjoyed reading it.Waiting for some more great articles like this from you in the coming days.

Posted by christian louboutin on sale on December 10, 2009 at 12:47 AM PST #

<a href="http://www.ourshoesbox.com">christian louboutin</a>
<a href="http://www.ourshoesbox.com">boots</a>
<a href="http://www.ourshoesbox.com">high heels</a>
<a href="http://www.ourshoesbox.com">womens boots</a>
<a href="http://www.ourshoesbox.com">heels</a>
<a href="http://www.ourshoesbox.com">women's shoes</a>
<a href="http://www.ourshoesbox.com">knee boots</a>
<a href="http://www.ourshoesbox.com">women's boots</a>

Posted by ling on December 18, 2009 at 07:54 PM PST #

http://www.christianlouboutinshoesdirect.com is very good,please come and see it.

Posted by christian louboutin on January 08, 2010 at 01:06 AM PST #

Thank you.Hot Shoes Cheap Jordan shoes michael jordan shoes and are on sale-Free shipping.

Posted by michael jordan shoes on January 10, 2010 at 05:54 PM PST #

thanks

Posted by ed hardy on January 13, 2010 at 04:16 PM PST #

When you<a href=http://www.alltopshoes.com/product_21.html>Puma Shoes</a> use a debit card<a href=http://www.alltopshoes.com/>Nike Dunks</a>, the money is <a href=http://www.alltopshoes.com/>Nike Dunk</a> immediately<a href= http://www.alltopshoes.com/product_3.html >Nike Dunk Low</a> taken from your checking account. While using <a href= http://www.alltopshoes.com/product_5.html >Nike Dunk High</a>
debit guarantees that you pay as you <a href=http://www.alltopshoes.com/product_19.html>Nike Air Force 1</a>go, these cards have downsides, including a growing appeal to thieves. "As economic conditions have worsened, there's been a noticeable increase in <a href=http://www.alltopshoes.com/product_19.html>Air Force 1 Shoes</a> all types of card fraud," says Avivah Litan, an analyst specializing in fraud detection and prevention at Gartner Research in Stamford, Conn<a href=http://www.alltopshoes.com/product_15.html>Bape Shoes</a>. "But ATM and debit-card fraud is the top area of concern we're hearing about from banks all over the world."

Posted by gigi on January 15, 2010 at 10:32 PM PST #

A group of[URL=http://www.pandorajewelrysale.com]Pandora Jewelry[/URL] soldiers were[URL=http://www.pandorajewelrysale.com]Pandora Charms[/URL] listening to[URL=http://www.pandorajewelrysale.com]Pandora Jewelry Store[/URL] the a song,[URL=http://www.pandorajewelrysale.com/bracelets-c-87.html]Pandora Bracelets[/URL] sharing her[URL=http://www.pandorajewelrysale.com/necklaces-c-88.html]Pandora Necklaces[/URL] loneliness and[URL=http://www.pandorajewelrysale.com/earrings-c-99.html]pandora earrings[/URL] longings. This[URL=http://www.pandorajewelrysale.com/rings-c-100.html]pandora rings[/URL] was the[URL=http://www.pandorajewelrysale.com/clips-c-93.html]pandora clips[/URL] spring of[URL=http://www.salejuicycouture.com]Juicy Couture[/URL] 1942; both[URL=http://www.salejuicycouture.com]juicy handbags[/URL] sides were[URL=http://www.salejuicycouture.com]Juicy Couture Clothing[/URL] far from home, but[URL=http://www.salejuicycouture.com/apparel-salejuicycouture-659.html]Juicy Couture Bottoms[/URL] they were[URL=http://www.salejuicycouture.com/apparel-salejuicycouture-659.html]Juicy Couture Apparel[/URL] all in love[URL=http://www.salejuicycouture.com/apparel-salejuicycouture-659.html]Juicy Bottoms[/URL] with the [URL=http://www.salejuicycouture.com/shoes-salejuicycouture-1554.html]Juicy Couture Shoes[/URL]same girl[URL=http://www.salejuicycouture.com/jewelry-salejuicycouture-1547.html]Juicy Couture Jewelry[/URL] in the song. So[URL=http://www.salejuicycouture.com/handbags-salejuicycouture-1564.html]Juicy Couture Handbag[/URL] were millions[URL=http://www.salejuicycouture.com/watches-salejuicycouture-1551.html]Juicy Couture Watches[/URL] of other[URL=http://www.salejuicycouture.com/handbags-salejuicycouture-1564.html]Juicy Couture Shoulder Bag[/URL]soldiers of [URL=http://www.salejuicycouture.com/jewelry-salejuicycouture-1547.html]Juicy Couture Earring[/URL]almost every [URL=http://www.salejuicycouture.com/jewelry-salejuicycouture-1547.html]Juicy Couture Bangle[/URL] nationality---and[URL=http://www.salejuicycouture.com/watches-salejuicycouture-1551.html]women's Watches[/URL] they continued [URL=http://www.swarovskicrystalshop.com]Swarovski Crystal[/URL]to sing [URL=http://www.swarovskicrystalshop.com]Swarovski Jewelry[/URL]of her to[URL=http://www.swarovskicrystalshop.com]Buy Swarovski Crystal[/URL] this day. Her[URL=http://www.swarovskicrystalshop.com/charms-c-89_89.html]Swarovski Charms[/URL] name was [URL=http://www.swarovskicrystalshop.com/necklaces-c-88_88.html]Swarovski Necklaces[/URL]Lilli Marlene[URL=http://www.swarovskicrystalshop.com/necklaces-c-88_88.html]Swarovski crystal necklace[/URL] who likes [URL=http://www.swarovskicrystalshop.com/bracelets-c-91_91.html]Swarovski Bracelets[/URL]Who was[URL=http://www.swarovskicrystalshop.com/bracelets-c-91_91.html]Swarovski Crystal Bracelets[/URL] Lilli, and how [URL=http://www.swarovskicrystalshop.com/earrings-c-92_92.html]Swarovski Earrings[/URL]did she transcend[URL=http://www.swarovskicrystalshop.com/earrings-c-92_92.html]Swarovski crystal Earrings[/URL] borders, languages[URL=http://www.abercrombiehotsale.com]abercrombie[/URL] and generations[URL=http://www.abercrombiehotsale.com]abercrombie sale[/URL] to become[URL=http://www.abercrombiehotsale.com]abercrombie and finch[/URL] every soldier's [URL=http://www.abercrombiehotsale.com]abercrombie sweater[/URL]sweetheart? Her[URL=http://www.abercrombiehotsale.com]abercrombie men[/URL] story begins[URL=http://www.abercrombiehotsale.com]abercrombie Trousers[/URL] in 1915, in the [URL=http://www.abercrombiehotsale.com]cheap abercrombie fitch[/URL]early stage[URL=http://www.abercrombiehotsale.com]abercrombie and fitch clothes[/URL] of World War[URL=http://www.footballjerseysonsale.com]football jerseys[/URL] I.One foggy [URL=http://www.footballjerseysonsale.com]soccer jerseys[/URL]April night[URL=http://www.footballjerseysonsale.com]Liverpool Jerseys[/URL] in Berlin, Hans[URL=http://www.footballjerseysonsale.com]Arsenal Jerseys[/URL] Leip, a young [URL=http://www.footballjerseysonsale.com]AC Milan Jerseys[/URL]officer with [URL=http://www.footballjerseysonsale.com]Juventus Jerseys[/URL] cadet and budding poet.

Posted by lyy on January 21, 2010 at 01:44 AM PST #

Post a Comment:
  • HTML Syntax: NOT allowed

This blog copyright 2010 by Wen Huang