Re: [RFC] UString

From: Date: Sun, 01 Mar 2015 20:30:16 +0000
Subject: Re: [RFC] UString
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  Groups: php.internals 
Request: Send a blank email to internals+get-84117@lists.php.net to get a copy of this message
On Sun, 1 Mar 2015, Yasuo Ohgaki wrote: > Hi Joe, > > On Sun, Mar 1, 2015 at 7:14 PM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote: > > > public function __construct([string $string [, string $source_codepage > > [, string $substitute_char] ]); > > One additional comment for constructor. It should have default > normalization. I think it should be NFC as most system uses it. (OSX > uses NFD for filenames! I hate it and most of Japanese developers hate > it) > > The API may be > > public function __construct([string $string [, string $source_codepage [, > string $substitute_char [, $normalization] ]); I wouldn't leave normalization as an option, and certainly not done by default. I would suggest other (mutable) methods, to convert between normalisation forms. > If $substitute_char is NULL, disallow invalid encoding. I don't think substitions (ie, data loss) should be allowed at all. This should thrown an immediate exception. If you really want this, I suggest adding a factory method for this. i.e. Text::createWithSubstitutions - or whatever better name. cheers, Derick

« previous php.internals (#84117) next »