HTMLのテーブルを​読み取ると、日本語が​文字化けしてしまいま​す。

15 visualizaciones (últimos 30 días)
一眞 青木
一眞 青木 el 1 de Dic. de 2022
Comentada: Kojiro Saito el 1 de Dic. de 2022
日本語の文字を含むHTMLをreadtableを実行してテーブルを読み取ったとき、日本語が文字化けしてしまうのはなぜですか?
以下のコマンドを実行し読み取りました。
opt = htmlImportOptions('TableSelector',"//TABLE[1]");
table = readtable(url,opt);

Respuesta aceptada

Kojiro Saito
Kojiro Saito el 1 de Dic. de 2022
Editada: Kojiro Saito el 1 de Dic. de 2022
エンコードが合っていないためだと思われます。readtableにweboptionsも引数に入れられるので、日本語の文字コードを指定してみたらどうでしょうか。
webopts = weboptions('CharacterEncoding', 'Shift_JIS');
% webopts = weboptions('CharacterEncoding', 'UTF-8');
table = readtable(url,opt, 'WebOptions', webopts)
  2 comentarios
一眞 青木
一眞 青木 el 1 de Dic. de 2022
ありがとうございます。ご指摘の通りにやり直したら解決しました。
Kojiro Saito
Kojiro Saito el 1 de Dic. de 2022
解決して良かったです。

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre データ型の変換 en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!