rfc:intl.char
This is an old revision of the document!
PHP RFC: IntlChar class
- Version: 1.0
- Date: 2014-11-24
- Author: Sara Golemon, pollita@php.net
- Status: Under Discussion
- First Published at: http://wiki.php.net/rfc/intl.char
Introduction
ICU exposes a great deal of i18n/l10n functionality beyond what is currently exposed by PHP. This RFC seeks to expose just a little bit more...
Proposal
Expose additional ICU functionality from uchar.h as intl_char_*() and matching oop interface IntlChar::*()
Proposed PHP Version(s)
PHP 7
New Constants
Enumerations of UProperty, UCharNameChoice, UPropertyNameChoice, UCharDirection, UBlockCode. For example:
class IntlChar { const PROPERTY_ALPHABETIC = _UCHAR_ALPHABETIC_; const PROPERTY_ASCII_HEX_DIGIT = _UCHAR_ASCII_HEX_DIGIT_; /* etc... */ const CHARNAME_UNICODE = _U_UNICODE_CHAR_NAME_; const CHARNAME_UNICODE10 = _U_UNICODE_10_CHAR_NAME_; const CHARNAME_EXTENDED = _U_EXTENDED_CHAR_NAME_; const CHARNAME_ALIAS = _U_CHAR_NAME_ALIAS_; /* etc... */ }
New Static Methods
Mapping of ICU API to PHP. For example:
class IntlChar { static public function hasBinaryProperty(int $codepoint, int $property): bool; static public function isAlphabetic(int $codepoint): bool; /* etc... */ } public function intl_char_has_binary_property($cp, $prop) { return IntlChar::hasBinaryProperty($cp, $prop); }
Proposed Voting Choices
50% + 1: “Merge IntlChar implementation as is?”
Note that I'll link a pull request from this RFC prior to opening voting, but after discussion has had time to agree on specifics of implementation
Implementation
I'll implement this after receiving feedback on the concept.
rfc/intl.char.1416890627.txt.gz · Last modified: 2017/09/22 13:28 (external edit)