You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Can't show Chinese word corrlecty, Maybe it's because GB2312 and GBk encoding is not supported #405
However I'm still not sure how to properly solve this as showing GB2312 file is a general issue as we are using UTF-8 encoding all over the place. We could of course check the encoding on open and convert the file to UTF-8 but not sure if that is the desired behavior. Needs more research on how other platforms handle such files.
Activity
juliusknorr commentedon Nov 11, 2019
Could you share an example file with me?
RavenLiao commentedon Nov 12, 2019
软件说明.txt
OK,this is the example file.
SimpleRealDT commentedon Dec 12, 2019
save problem
xayane commentedon Dec 16, 2019
same problem
caichao0519 commentedon Dec 16, 2019
same problem
juliusknorr commentedon Dec 18, 2019
So I was finally able to display the file on my development machine with the following PHP code:
However I'm still not sure how to properly solve this as showing GB2312 file is a general issue as we are using UTF-8 encoding all over the place. We could of course check the encoding on open and convert the file to UTF-8 but not sure if that is the desired behavior. Needs more research on how other platforms handle such files.
LL223851 commentedon Dec 27, 2019
这个我弄好了,反正都是中国人会遇到这个问题,就用中文来回答吧,没测试所有文件类型,不知道这样做会不会引发其他问题。
修改文件路径:/服务器路径/nextcloud/apps/text/lib/Service/ApiService.php
第112行(line 112)修改为
return new FileDisplayResponse($file);
--->
$fileContents=$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);
$file->putContent($fileContents );
return new FileDisplayResponse($file);
juliusknorr commentedon Oct 4, 2020
Same issue for "windows-1250", see nextcloud/android#6685 (comment) for an example file