|
|
@@ -13380,9 +13380,9 @@ Q版卡通风格,头大身小,造型圆润可爱,线条简单,色彩明
|
|
|
// 获取当前章节标题
|
|
|
$titleLine = trim($matches[0][$i][0]);
|
|
|
// 去除标题开头的特殊符号
|
|
|
- $cleanTitle = preg_replace('/^[#*·\-_=\s]+/', '', $titleLine);
|
|
|
+ $cleanTitle = preg_replace('/^[#*·\-_=\s]+/u', '', $titleLine);
|
|
|
// 去除标题结尾的冒号和特殊符号
|
|
|
- $cleanTitle = preg_replace('/[#*·::\s]+$/', '', $cleanTitle);
|
|
|
+ $cleanTitle = preg_replace('/[#*·::\s]+$/u', '', $cleanTitle);
|
|
|
$cleanTitle = trim($cleanTitle);
|
|
|
|
|
|
// 获取当前标题的结束位置
|
|
|
@@ -13482,6 +13482,12 @@ Q版卡通风格,头大身小,造型圆润可爱,线条简单,色彩明
|
|
|
Utils::throwError('20003:不支持的文件格式,支持:txt、pdf');
|
|
|
}
|
|
|
|
|
|
+ // 移除非法 UTF-8 字节,避免后续 JSON 编码或正则解析异常
|
|
|
+ if (!mb_check_encoding($content, 'UTF-8')) {
|
|
|
+ $cleaned = @iconv('UTF-8', 'UTF-8//IGNORE', $content);
|
|
|
+ $content = $cleaned === false ? $content : $cleaned;
|
|
|
+ }
|
|
|
+
|
|
|
return $content;
|
|
|
}
|
|
|
|