1

I am trying to do a str_replace on the following line:

team 4 -1ööööö57167168

I've been able to do it in the past just by doing this:

str_replace("ööööö", " ",trim($line));

The desired outcome should be team 4 -1 57167168

However, now that I'm trying to do it in a Codeigniter application, it fails to replace it and I'm not sure what to try.

Is this an encoding config issue with Codeigniter? How can I get it to replace correctly?

4

2 回答 2

1

在此处查看多字节字符串函数http://php.net/manual/en/ref.mbstring.php,特别是 mb_str_replace。

请注意,ö 可以用多个字符集表示,因此请确保匹配正确的字符集!

于 2012-08-12T22:37:07.183 回答
-3

使用 utf8_encode() 和 utf8_decode(),PHP 不是 UTF8 原生语言!

于 2012-08-12T22:33:12.383 回答