Re: [RFC] IntlChar class and intl_char_*() functions

From: Date: Tue, 02 Dec 2014 05:25:07 +0000
Subject: Re: [RFC] IntlChar class and intl_char_*() functions
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-79369@lists.php.net to get a copy of this message
> On 28 Nov 2014, at 06:49, Stanislav Malyshev <smalyshev@gmail.com> wrote: > >> If we add that, we should also have an analogue of JavaScript’s >> String.charCodeAt/String.codePointAt to do the operation in reverse. > > That'd be a bit harder since it's not clear what "at" means there - > byte? codepoint? grapheme? what about broken UTF-8 sequences? What if > you run this function on non-UTF-8 array? Etc. So this one is trickier, > the other direction is easy. It'd work with codepoints, but it strikes me now that this would be a job for UStrings. We could have u($some_input)->codePointAt(7) alongside u($some_input)[7]. Since UString works with codepoints and is guaranteed to be Unicode, this works. -- Andrea Faulds http://ajf.me/

« previous php.internals (#79369) next »