Re: [PHP] UTF-8 support

2007-08-04 Thread Daniel Macedo

Hi Naz,

Any byte function is NOT safe for UTF-8.
trim() works properly with UTF-8 IF you don't specify the charlist 
(second argument). This is because all whitespace characters are in the 
ASCII range, and therefore it won't corrupt the UTF-8 string.


The explode() function will handle UTF-8 as long as it's well formed.
This means that if you properly specify UTF-8 delimiters, it doesn't 
corrupt the UTF-8 input string.


~ DM


adel escreveu:

http://www.php.net/manual/en/ref.mbstring.php

On 8/3/07, Naz Gassiep [EMAIL PROTECTED] wrote:

The functions trim() and explode() appear to be munging multibyte UTF-8
strings. I can't find multibyte safe versions of them in the manual, do
they exist, or do I have to make my own?
- Naz.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] UTF-8 support

2007-08-04 Thread Daniel Macedo
Yes it will, trim() was given the option to specify other characters in 
PHP 4.1.0.


Rember that it's a byte function, so single byte characters can be 
handled, you just can't use it for multi-byte characters.


~ DM


Naz Gassiep escreveu:
Great! Thanks for the answer, that's very helpful. Will trim() work if I 
specify charlists in the ASCII range? Not that I ever do, but just curious.

- Naz


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: function - action

2007-08-03 Thread Daniel Macedo

Ralph Kutschera escreveu:

Hallo!

  I'm working on a project, where we distinguish between functions and
actions in design, although in PHP both are implemented as functions.
Is there a chance that PHP can use the word action as function?

E.g.:
public function doSomething() {  }
public action doSomethingElse() { ... }

... is actually the same but would help to see the design also in the code.

TIA, Ralph


That's not implemented in PHP language.

What you should do is use adequate naming conventions, use verbs and as 
far as possible, describe what the function does:


public function execute_someaction() {}
public function sanitize_somedata() {}
public function is_validwhatever() {}

Can you understand what each function does by their names? What should 
they return? How about in your application(s)...


~ DM

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php