簡體   English   中英

mb_detect_encoding 沒有檢測到 SJIS-mac?

[英]mb_detect_encoding does not detect SJIS-mac?

我有一個 SJIS 編碼的 csv 文件。

當我調用mb_convert_encoding($contentOfFile, 'UTF-8', 'SJIS-mac') ,UTF-8 輸出是正確的。

但是當我使用mb_detect_encoding($contentOfFile, ['SJIS-mac', 'SJIS-win', 'SJIS', 'UTF-8']) ,它總是返回 SJIS-win。

PHP 版本:7.2.11

<?php

$utf8Str = "❶❷❸❹❺";

$sjisStr = mb_convert_encoding($utf8Str, 'SJIS-mac');

echo(mb_detect_encoding($sjisStr, ['UTF-8','SJIS-win', 'SJIS-mac', 'SJIS']));

這是 PHP 的 mbstring 擴展中的一個錯誤,我正在修復它。 (當我正在修復錯誤時發現您的問題非常有趣!)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM