Re: PHP 6
| From: | Moriyoshi Koizumi | Date: | Sat, 13 Mar 2010 14:13:39 +0000 |
| Subject: | Re: PHP 6 | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-47221@lists.php.net to get a copy of this message | ||
On Sat, Mar 13, 2010 at 6:07 PM, Chen Ze <surfchen@gmail.com> wrote:
> I think unicode should only care for string handling. Formatting
> numbers should not be the thing that unicode cares. Unicode is a
> standard for text, not for text or number formatting.
>
> Back to the days we don't have unicode, the number formatting have
> already existed. It even exists when computer was not invented.
>
> That is same for sorting.
>
> When we think about Unicode, we should think about those really
> related to Unicode,like file system. Number formatting and sorting are
> other things which intl cares.
>
> For the unicode, I think we should implement something like:
>
> $chars=new mchar($bytes,$bytes_encoding);
> echo $chars;//output encoding
> foreach ($chars as $char) {
> echo $char;//output single utf-16/utf-8 char (depends on default
> output encoding)
> }
> echo $chars->bytes('gbk');
>
> $chars->outputEncoding('gbk');
> echo $chars;
>
> ini_set('mchar_output_encoding','gbk');
> echo $chars;
>
> ini_set('mchar_filesystem_encoding','gbk');
> echo $chars->filepath();
>
I don't totally agree with what is being said here, but I guess we
don't have to make Unicode a first-class value. Once operator
overloading is supported, Unicode strings can be represented as
objects, like Python does although I didn't have a look at past
discussion on this topic.
Moriyoshi