Fwd: String length

Moriyoshi Koizumi <[email protected]>
Newsgroups gmane.comp.php.internationalization
Message-ID <[email protected]>
Seems I forgot to CC to the list. Sorry for messing about.

Moriyoshi

> From: Moriyoshi Koizumi <[email protected]>
> To: Hayk Chamyan <[email protected]>
> Subject: Re: [PHP-I18N] String length
> Content-Type: text/plain; charset=US-ASCII; format=flowed
> Message-Id: <[email protected]>
>
> Hi,
>
> On 2004/02/05, at 18:19, Hayk Chamyan wrote:
>
>>
>> Hi All.
>> I've got a question regarding the length of binary strings in MB 
>> String.
>> Now strlen(file_get_contents('file.bin')) returns string length in 
>> bytes. However, if in php.ini we overload the mb_strlen function in 
>> place of strlen, specifying mbstring.internal_encoding='UTF8', the 
>> result will be wrong.
>> In this regard the question is whether or not a function like 
>> mb_strleninbytes expected to return the string lenght in bytes is 
>> going to be introduced? Or, do you plan to use mb_strlen($str, ASCII) 
>> everywhere instead?
>
>
> You can use mb_orig_strlen() where the byte-wise behaviour is
> needed, when strlen() is overloaded by mb_strlen(). The same applies to
> other mbstring counterparts (e.g. substr() - mb_substr() - 
> mb_orig_substr()).
> This is an undocumented feature though.
>
> BTW, while it's found useful sometimes, it's also discouraged to use 
> function
> overloading as strlen() is the only reasonable way to retrieve the 
> length
> of a binary object in bytes at this time. I couldn't assure this, but
> sizeof() / count() will likely replace that functionality of strlen() 
> and
> strlen() will probably be used solely to get the actual character 
> count.
>
>
> Moriyoshi
>

-- 
PHP Internationalization Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.