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

10 ビュー (過去 30 日間)
一眞 青木
一眞 青木 2022 年 12 月 1 日
コメント済み: Kojiro Saito 2022 年 12 月 1 日
日本語の文字を含むHTMLをreadtableを実行してテーブルを読み取ったとき、日本語が文字化けしてしまうのはなぜですか?
以下のコマンドを実行し読み取りました。
opt = htmlImportOptions('TableSelector',"//TABLE[1]");
table = readtable(url,opt);

採用された回答

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

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLanguage Support についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!