Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84117 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58425 invoked from network); 1 Mar 2015 20:30:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Mar 2015 20:30:22 -0000 Authentication-Results: pb1.pair.com header.from=derick@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=derick@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 82.113.146.227 as permitted sender) X-PHP-List-Original-Sender: derick@php.net X-Host-Fingerprint: 82.113.146.227 xdebug.org Linux 2.6 Received: from [82.113.146.227] ([82.113.146.227:51305] helo=xdebug.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C0/C0-53678-DD673F45 for ; Sun, 01 Mar 2015 15:30:22 -0500 Received: from localhost (localhost [IPv6:::1]) by xdebug.org (Postfix) with ESMTPS id 15663EA0C0; Sun, 1 Mar 2015 20:30:16 +0000 (GMT) Date: Sun, 1 Mar 2015 20:30:16 +0000 (GMT) X-X-Sender: derick@whisky.home.derickrethans.nl To: Yasuo Ohgaki cc: Joe Watkins , Chris Wright , Stas Malyshev , =?UTF-8?Q?Johannes_Schl=C3=BCter?= , Andrea Faulds , Dmitry Stogov , Philip Hofstetter , PHP Internals In-Reply-To: Message-ID: References: <1413875212.2624.3.camel@localhost.localdomain> <54469840.3070708@sugarcrm.com> <1414051917.2624.35.camel@localhost.localdomain> <1414060726.2624.60.camel@localhost.localdomain> <1414072403.3228.3.camel@kuechenschabe> <87D717D5-273B-4A32-A3E5-83EBDFD314CB@ajf.me> <1414077690.3228.12.camel@kuechenschabe> <54495CF6.30608@sugarcrm.com> <1414130585.2624.64.camel@localhost.localdomain> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [PHP-DEV] [RFC] UString From: derick@php.net (Derick Rethans) On Sun, 1 Mar 2015, Yasuo Ohgaki wrote: > Hi Joe, > > On Sun, Mar 1, 2015 at 7:14 PM, Yasuo Ohgaki 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