Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79233 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 13933 invoked from network); 27 Nov 2014 15:18:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Nov 2014 15:18:04 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.180 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.212.180 mail-wi0-f180.google.com Received: from [209.85.212.180] ([209.85.212.180:51861] helo=mail-wi0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F2/A3-27910-CA047745 for ; Thu, 27 Nov 2014 10:18:04 -0500 Received: by mail-wi0-f180.google.com with SMTP id n3so8657034wiv.1 for ; Thu, 27 Nov 2014 07:18:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=TMDpydEhyQrxURMWRDSpOqwQfeOZ3sMt3WJKfdVck8M=; b=TjStDH0A2e4he3Ud5rYYi34swyc6T3oPpZ7hro9oltS7l8XZcd5A+bbnFr5dlwd8SJ leF8ioSgWyTqNddy0+98YOtubphClhbEsCVQ5aAdA9wCgGI38XLiZLNb/zxYgljq+giK 6fSkYox2eTQgQBn4e8pCfMjXfFcyi3BZ1kbXk0Jm1OrIoLOn8htnQjUhF7D2U059LVLJ F/hZ4IOfNnp6aec74DNnKMFbQYF9NNHFwwwHqAUhzIpzHbeihwgE8H79MSNgz+OoA1a+ v0zwrBCndKMz72Mltz9S1AMwQJSH5jXBkHcqmA48MIJEHk/dGvdyhr4HLUuMvKt7QKpK KFUQ== X-Received: by 10.194.184.75 with SMTP id es11mr59567678wjc.35.1417101480504; Thu, 27 Nov 2014 07:18:00 -0800 (PST) Received: from [192.168.0.148] ([62.189.198.114]) by mx.google.com with ESMTPSA id cq4sm11123625wjc.35.2014.11.27.07.17.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Nov 2014 07:17:59 -0800 (PST) Message-ID: <54774075.2090904@gmail.com> Date: Thu, 27 Nov 2014 15:17:09 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: internals@lists.php.net References: <54767CAC.9060608@gmail.com> <5476DF5C.6040807@gmail.com> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] [RFC] IntlChar class and intl_char_*() functions From: rowan.collins@gmail.com (Rowan Collins) Andrea Faulds wrote on 27/11/2014 13:48: >> On 27 Nov 2014, at 08:22, Stanislav Malyshev wrote: >> >> Looking into this and also reading the \u{} proposal, I also thought - >> do we have a programmatic way of doing what \u would do? I.e. if we >> assume $x holds an Unicode codepoint value (i.e., an integer) do we have >> a good built-in way to generate the corresponding utf8 sequence? >> If not, then I think this class may be a good place to put such a >> function in. > You mean something along the lines of JavaScript’s String.fromCharCode (or, in ES6, String.fromCodePoint)? > > One of the nice things about that function is that it can take multiple codes. So I can do String.fromCodePoint(65, 66, 67) to get “ABC”. > > If we add that, we should also have an analogue of JavaScript’s String.charCodeAt/String.codePointAt to do the operation in reverse. We already have the single-byte versions: chr() and ord(). It's been on my to do list for a while to rewrite the manual pages for those, which currently have a whole lot of misleading references to ASCII.