On Sun, 1 Mar 2015, Yasuo Ohgaki wrote:

> Hi Joe,
> 
> On Sun, Mar 1, 2015 at 7:14 PM, Yasuo Ohgaki <yohg...@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

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to