0
我正在调试Drupal模块(此模块,webform_import,将CSV数据导入到数据库中)并获取一些导致模块中出现错误的不可打印字符。这里是我的调试代码在字符串中的非打印字符-php
if($v == 'semester'){
dpm('found ' . $v);
}
else
{
dpm('not found ' . $v);
dpm(str_split($v));
}
dpm($v);
变量$ V通过下面的函数
function _webform_import_csvfieldtrim($value) {
$value = trim($value);
// Strip off the beginning and ending quotes if necessary.
$value = preg_replace('/^".*"$/', '', $value);
// Remove control characters. Some editors add invalid EOL chars.
// fgetcsv does not handle unicode characters therefore we replace them
// manually. See http://bugs.php.net/bug.php?id=31632.
$value = str_replace('\x00..\x1F\xfe\xff', '', $value);
//$value = str_replace('/[\x00-\x1F\x80-\xFF]/', '', $value);
return $value;
}
的输出根据输出,$ V版画“学期',但不等于字符串'学期',当转换为数组时有11个字符而不是8个。请让我知道_webform_import_csvfieldtrim函数是否有问题。另外,我已将CSV文件的编码转换为UTF-8。
谢谢。