UTF-16エンコー​ド形式ファイルの読み​込みに関して

12 vues (au cours des 30 derniers jours)
Teppei Iwata
Teppei Iwata le 30 Oct 2019
Commenté : Teppei Iwata le 31 Oct 2019
MATLABのreadtable関数を使用してUTF-16のエンコード形式のcsvファイルを読み込みたいのですが以下の警告が出て正しく読み込むことができません.
警告: ファイルに UTF-16 のバイト順マークが含まれていますが、これはファイルを開くために使用したエンコードと一致しません。これらの
バイトはスキップされます。
Shift_JIS を使用して引き続き読み取ります。
> In matlab.io.internal.utility.warnOnBOMmismatch (line 10)
In matlab.io.internal.utility.updateFIDforBOM (line 39)
In table/readTextFile>fopenEnc (line 594)
In table/readTextFile>openFile (line 599)
In table/readTextFile (line 103)
In table.readFromFile (line 44)
In readtable (line 216)
In margeFiles (line 105)
警告: ファイルに UTF-16 のバイト順マークが含まれていますが、これはファイルを開くために使用したエンコードと一致しません。これらの
バイトはスキップされます。
Shift_JIS を使用して引き続き読み取ります。
> In matlab.io.internal.utility.warnOnBOMmismatch (line 10)
In matlab.io.internal.text.getTextOpts (line 61)
In table/readTextFile (line 137)
In table.readFromFile (line 44)
In readtable (line 216)
In margeFiles (line 105)
readtableはUTF-16のエンコード形式に対応してないように見えるのですがどのようにすればよいでしょうか.

Réponses (1)

Kazuya
Kazuya le 31 Oct 2019
UTF-16 は対応してなさそうですね。readtable で 'Encoding' を指定できますが、リストに UTF-16 がありません。
他の関連質問の答えが参考になるかもしれないので:
MatLab doesn't read my .TXT file correct(UTF-16 から UTF-8 に変換しています)
  1 commentaire
Teppei Iwata
Teppei Iwata le 31 Oct 2019
ありがとうございます,
> MatLab doesn't read my .TXT file correct(UTF-16 から UTF-8 に変換しています)
こちらを元にUTF-16からUTF-8に変換することでreadtableでの読み込みに成功いたしました.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Text Data Preparation dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!