News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Project:
Patchwork-UTF8 - UTF8 Support for PHP
January 27, 2012 @ 11:38:40

Nicolas Grekas has shared another tool that he's pulled out of his "Patchwork" framework to make it a stand-alone tool: the Patchwork-UTF8 helper that provides matching functions to those PHP already has for regular strings, but a little smarter to work with UTF8 correctly.

The PatchworkUtf8 class implements the quasi complete set of string functions that need UTF-8 grapheme clusters awareness. These functions are all static methods of the PatchworkUtf8 class. The best way to use them is to add a use PatchworkUtf8 as u; at the beginning of your files, then when UTF-8 awareness is required, prefix by u:: when calling them.

In the README for the tool he talks about the functions included in the current release that match PHP's string functions as well as some additional methods like "isUtf8", "bestFit" and "strtocasefold". It relies on the mbstring, iconv and intl extensions being installed, and if they aren't, it falls back to other functionality (list of those methods included).

0 comments voice your opinion now!
utf8 support string patchwork framework helper mbstring iconv intl


blog comments powered by Disqus

Similar Posts

Padraic Brady's Blog: Zend Framework 2.0 Is Coming! Are You Paying Attention End-Users?

Joshua Thijssen: @MultiParamConverter for Symfony2

Mike Purcell's Blog: PHPUnit - Upgrade - Convert assertType to assertInternalType

Zend Developer Zone: It\'s Time for Woodie\'s Framework Roundup (it\'s a Toy Story 2 Reference)

Matthew Weir O'Phinney's Blog: BostonPHP Framework Presentations


Community Events





Don't see your event here?
Let us know!


podcast library release install community application threedevsandamaybe language series bugfix symfony code laravel api list configure introduction wordpress developer interview

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework