2015-10-20 105 views
-1

我想從csv文件中刪除windows垃圾字符( )並保留utf字符。
我試過下面的東西,但沒有工作。從文件或字符串中刪除windows字符( )from php/perl

mb_convert_encoding. 
preg_replace('/[^\p{L}\s]/u','',$str); 
utf8_encode 
+0

這看起來很像[這個問題](http://stackoverflow.com/questions/33216268/equivalent-for-mb-convert-encoding-in-perl/33218899)。你們兩個一起工作嗎? –

回答

1

試試這個:

$str = mb_convert_encoding($str, 'UTF-8', 'UTF-8'); 

它將刪除無效字符。