nextcloud中文乱码问题

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
这里改成这样,就可以解决txt中文乱码问题(测试之后确实可以,但是为导致整个系统样式错乱)
/**
* @param IOutput $output
* @since 11.0.0
*/
public function callback(IOutput $output) {
if ($output->getHttpResponseCode() !== Http::STATUS_NOT_MODIFIED) {
$output->setHeader('Content-Length: ' . $this->file->getSize());
//$output->setOutput($this->file->getContent());
$fileContents=$this->file->getContent();
$encoding = mb_detect_encoding($fileContents . "a", "UTF-8,GB2312, GBK, WINDOWS-1252, ISO-8859-15, ISO-8859-1, ASCII", true);
if ($encoding === "") {
$encoding = "ISO-8859-15";
}
$fileContents = iconv($encoding, "UTF-8", $fileContents);
$output->setOutput($fileContents);
}
}


nextcloud中文乱码问题
http://example.com/2025/04/03/nextcloud中文乱码问题/
作者
zgx
发布于
2025年4月3日
许可协议