Re: trimming spaces from multibyte strings

Moriyoshi Koizumi <[email protected]>
Newsgroups gmane.comp.php.internationalization
Message-ID <20030508020331C2VoW&@at.wakwak.com>
Jean-Christian Imbeault <[email protected]> wrote:

> Moriyoshi Koizumi wrote:
> > 
> > Since trim() can take the second parameter as well so you can specify which
> > character to be trimmed,
> 
> True. But if I understand correctly then the "default" trim() (without 
> supplying a list of characters) *is* multibyte safe, though it might not 
> remove all whitespace?

Right, the default behaviour of trim() is *known* to be multibyte safe.

> >>But since you suggest it I will ask for this as a new feature as I 
> >>really do find it difficult to remove whitespace from multibyte strings :)
> > 
> > Well, do you really find it difficult? :)
> 
> Yes. Horribly so :) In my case it is difficult because for one, our PHP 
> server do not have japanese input or editing capabilities so I cannot 
> type any Japanese into a regexp for example, secondly I often access PHP 
> servers across SSH from a non-japanese machine so even if the server 
> could handle japanese input I don't have an IME ...

What SSH client do you usually use? I use TeraTerm Pro with an SSH 
extension.

TeraTerm Pro: http://hp.vector.co.jp/authors/VA002416/teraterm.html
TTSSH: http://www.zip.com.au/~roca/ttssh.html

> But my main gripe is that someone came up with the wonderful trim() 
> function. Could someone come up with the wonderful mb_trim() function? 
> :) I would code it myself and contribute but I am not very proficient in 
> the issues concerning multibyte character sets :(

Yes, there could well be the wonderful mb_trim() and your contribution 
will be greatly appreciated, but I don't realise the number of people who 
demand that yet, and some equivalent made of userland functions will 
suffice. Your request still seems to me in a narrow niche :)

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.