我有一个文本文件。包含“砡”字,编码为Shift-JIS。
我在 PHP(Laravel)中使用函数 file_get_contents() 来读取这个文件,然后在 json 中响应客户端。
$file = file_get_contents("/path/to/file/text");
$file = iconv("SJIS", "UTF-8//IGNORE", $file);
return response()->json(['content' => $file]);
但是,这个字符“砡”没有正确显示,它显示为“x”。
我如何解决它 ?