Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:63717 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 27393 invoked from network); 30 Oct 2012 16:11:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Oct 2012 16:11:15 -0000 Authentication-Results: pb1.pair.com header.from=php@golemon.com; sender-id=softfail Authentication-Results: pb1.pair.com smtp.mail=php@golemon.com; spf=softfail; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain golemon.com does not designate 209.85.223.170 as permitted sender) X-PHP-List-Original-Sender: php@golemon.com X-Host-Fingerprint: 209.85.223.170 mail-ie0-f170.google.com Received: from [209.85.223.170] ([209.85.223.170:35188] helo=mail-ie0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4A/A0-23554-22CFF805 for ; Tue, 30 Oct 2012 11:11:15 -0500 Received: by mail-ie0-f170.google.com with SMTP id c12so735122ieb.29 for ; Tue, 30 Oct 2012 09:11:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:x-originating-ip:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :x-gm-message-state; bh=YzCtOxhi9VfD/menvFz/oPw0Bg+IA8M/7xDFf51u+7k=; b=azLKa/dCLyJ9IWFyceLj/5zxM4Vi44pkqEOgzuoSkN960qjJx0pMBSfW87TLx/yrvX 5x3dAejBdr62gkl9KX1Bx8Dh2r64ipgz5vtg+JbMx1xqHs5pk1BQZs+PY9ntSEK4ocUt Km+C+Lj5IUfUZa/gDQPTOrpWS4vkQ0wGLyYCj6W8Pu7NqB9PqH3GRtdWpX7dOq5KBORT DncTYsK8eQZSbm6KnHnxYRKBvj3Gz/D7qO5clplA2OjRvXhGkQNmsq1PJARO5w57jjzu 1XpyR7nXyfCjGB79mGyFnVRMg+mhQD+PdP4KG96Gzq954GzPrGkErnacID4UG62ZW3U7 TVUQ== MIME-Version: 1.0 Received: by 10.43.120.9 with SMTP id fw9mr28646296icc.46.1351613471150; Tue, 30 Oct 2012 09:11:11 -0700 (PDT) Sender: php@golemon.com Received: by 10.64.21.193 with HTTP; Tue, 30 Oct 2012 09:11:11 -0700 (PDT) X-Originating-IP: [98.210.180.187] In-Reply-To: References: Date: Tue, 30 Oct 2012 09:11:11 -0700 X-Google-Sender-Auth: 03w3_4_A-XWIQSBioUsIKi1JNXY Message-ID: To: Pierre Joye Cc: PHP internals Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQmL3aj0YsgoGAYuxiSp20eDRUXSrmI+XqyoPKkC48qKPnzzfhXNuGkXtr8h8dCt+a66K5Lh Subject: Re: [PHP-DEV] [RFC] ICU UConverter implementation for ext/intl From: pollita@php.net (Sara Golemon) > - the UCNV prefix is not necessary, we are in the UConverter class > already, I would simply use LATIN_1, or ILLEGAL for exampe. > - I would add ERROR_ to the error related constants (UNASSIGNED & co), or? > For the UConverterType enum I could maybe get behind that. For UConverterCallbackReason I think we need something, but ERROR_ isn't universally applicable since three are just status incidents (UCNV_RESET, UCNV_CLOSE, UCNV_CLONE). Perhaps: REASON_* for these? In that vein, I'd be tempted to make the UConverterType values be TYPE_* > - It is OO, we should or could use exception. Warning are not nice to > deal with and errors are quite common during conversion > We are. UConverterException is thrown everywhere but one place. That one exception is the static method I added to give a non-oop-like API for the most core functionality. Given its non-oopness, I left it non-exceptiony. See Gustvo's notes about error handling below. > Some questions, is 'latin1' the same than const UCNV_LATIN_1? or is > there any relation between the two? > The UCNV_LATIN1 constant is a numeric value, so they're not the same, no. The relationship is that when you instantiate a UConverter with 'latin1' (or 'iso-8859-1', or any of its aliases), $conv->getSourceType() (or getDestinationType() as appropriate) will return UConverter::UCNV_LATIN_1. Each type in the UConverterType set uses a different algorithm approach to do the character conversion. Sets like latin1, utf*, ascii, etc... can be done faster than sets like 'koi8-r' because the conversions are simple bitshifts (very simple in the case of ascii/latin1). This just surfaces some info on what the converter is doing internally and isn't much use beyond a bit of logging, in practice. > btw, can you add the changes to config.w32 too pls? > Ah, right sorry, had meant to do that at the last minute. Will add that in a bit, > Error handling is done in a different way from the rest of the extension. > Unusual as this may be, it would be a bad idea to introduce inconsistency > here. See the implementations in the other modules. > I do agree, I was hoping I could slip that one by. :p I'll take another look at the rest of ext/intl and see about adapting my error handling. > The tests have poor coverage. > The important bits are hit, but yeah, it could stand to have better testing. I'll add some.