PHP使用Shift_JIS转换编码

时间:2017-02-20 12:46:22

标签: php utf-8 shift-jis

我有一个文本文件。它包含“砡”字符,其编码为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”。

我该如何解决?

0 个答案:

没有答案