开发者

php regular expression for unicode

I have some text where unicode is written as text l开发者_JAVA百科ike this

There areu25ba 2 boys.

it should be like this

There are&#x25ba 2 boys.

Replace 'u' with '&#x' if there is unicode character.

Thanks in advance


A naive way would be:

preg_replace('/u([0-9a-fA-F]{4})/','&#x$1;',$string);

But I doubt 'udaff' would appreciate it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜