This document describes a request for a string helper class within Zend Framework.
The reason I wrote this RFC was based on believing working with strings of different and/or multi-byte character sets in PHP isn't that simple as the build-in string functions supported by PHP.
Until now ext/iconv is often used to work with character sets within Zend Framework. But sometimes it's not enough because it isn't installed everywhere. You shouldn't hard require ext/iconv.
There is another extension ext/mbstring that can be used, too. As Fallback build-in functions can be used to handle single byte character sets.
The utility class (or set of classes) should contain methods to work with different character sets like strlen, substr etc. It should contain methods to identify character set byte lengths and it should be as fast as possible because of high frequency method calls.
This should solve the hard requirement of ext/iconv so users can choose the favorite extension for working with different character sets.
Because of tons of components working with ext/iconv or ext/mbstring currently the class could live in Zend\Stdlib but Zend\Text or an own namespace could be possible.
For now did some performance tests how to make a great performance possible.
The fasted is using an adapter for each wrapper class and a static base class for basic methods like "isCharsetSingleByte()". The static class contains a specialized getter to get the best available wrapper for a given character set to work with.
The current implementation is available @ https://github.com/marc-mabe/zf2/blob/string/library/Zend/Stdlib/StringUtils.php