[PHP] Help preg_replace with Non-English character

2008-05-22 Thread Shelley
Hi all,

Just a question, I want to replace some Chinese characters with
preg_replace().

But it does not work.

The string is

$str = 'test你好http://www.phparch.cn/ 完成';

The ideal output is :
testa href=http://www.phparch.cn;你好/a 完成

Any suggestion will be greatly appreciated.

-- 
Regards,
Shelley


Re: [PHP] Help preg_replace with Non-English character

2008-05-22 Thread Richard Heyes

Just a question, I want to replace some Chinese characters with
preg_replace().

But it does not work.

The string is

$str = 'test你好http://www.phparch.cn/ 完成';

The ideal output is :
testa href=http://www.phparch.cn;你好/a 完成

Any suggestion will be greatly appreciated.


Have a look to see if the mb_* functions will help.

http://uk3.php.net/manual/en/book.mbstring.php


--
  Richard Heyes

 In Cambridge? Employ me
http://www.phpguru.org/cv

++
| Access SSH with a Windows mapped drive |
|http://www.phpguru.org/sftpdrive|
++

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



Re: [PHP] Help preg_replace with Non-English character

2008-05-22 Thread Shelley
Yes, I have checked and tried that.
And I have successfully tested it with GB2312 encoding, but when turned to
UTF8. It does not work any more.
The server is using UTF8 encoding, and also the database.
Weird.

On Thu, May 22, 2008 at 4:51 PM, Richard Heyes [EMAIL PROTECTED] wrote:

 Just a question, I want to replace some Chinese characters with
 preg_replace().

 But it does not work.

 The string is

 $str = 'test你好http://www.phparch.cn/ 完成';

 The ideal output is :
 testa href=http://www.phparch.cn;你好/a 完成

 Any suggestion will be greatly appreciated.


 Have a look to see if the mb_* functions will help.

 http://uk3.php.net/manual/en/book.mbstring.php


 --
  Richard Heyes

 In Cambridge? Employ me
http://www.phpguru.org/cv

 ++
 | Access SSH with a Windows mapped drive |
 |http://www.phpguru.org/sftpdrive|
 ++




-- 
Regards,
Shelley