RE: [PHP-I18N] proposal: unification of the grapheme_extract functions
| From: | Texin, Tex | Date: | Thu, 08 May 2008 18:39:33 +0000 |
| Subject: | RE: [PHP-I18N] proposal: unification of the grapheme_extract functions | ||
| References: | 1 | Groups: | php.i18n |
| Request: | Send a blank email to php-i18n+get-1177@lists.php.net to get a copy of this message | ||
Ed,
If I use GRAPHEME_EXTR_MAXBYTES, does it return that exact number of bytes, or either the maximum
number of whole unicode characters or whole graphemes that can be extracted without exceeding the
max bytes?
I assume it is the max # of whole graphemes that do not exceed the max bytes.
The use case is to have a limited storage area for unicode text such as a filename that is limited
to 8 bytes, or mail with a subject heading limited to 60 (pick a number) bytes. It is needed to make
the string a proper unicode string that displays meaningfully. So if I extract from a larger field,
I want the max number of graphemes that fit in my storage space.
Is that what it does?
Also, the $start value is that in byte, character or grapheme units for each of the types?
tex
> -----Original Message-----
> From: Ed Batutis [mailto:ed@batutis.com]
> Sent: Friday, May 02, 2008 2:49 PM
> To: php-i18n@lists.php.net
> Subject: [PHP-I18N] proposal: unification of the
> grapheme_extract functions
>
> Hi,
>
> I am proposing to unify the three grapheme_extract functions this way:
>
> string grapheme_extract ( string $haystack ,
> int $size
> [, int $extract_type
> [, string $start ]] )
>
> where $extract_type is:
>
> GRAPHEME_EXTR_COUNT - $size is number of graphemes (default)
> GRAPHEME_EXTR_MAXBYTES - $size is maximum number of bytes to
> extract GRAPHEME_EXTR_MAXCHARS - $size is maximum number of
> UTF-8 character to extract
>
> and the other arguments are as in the current set of extract
> functions.
>
> Sorry if I missed someone's proposal for this - I am only on
> the php-i18n list at this point. Please post your proposal to
> this list, if possible.
>
> Thanks,
>
> =Ed
>
>
>
> --
> PHP Unicode & I18N Mailing List (http://www.php.net/) To
> unsubscribe, visit: http://www.php.net/unsub.php
>
>