Skip to content

Commit

Permalink
UTF-8の判定を誤っていたので修正 #386
Browse files Browse the repository at this point in the history
- 次の範囲をUTF-8ではないと判定していた
  - U+20000 (UTF-8: 0xf0 0xa0 0x80 0x80) から
  - U+3FFFF (UTF-8: 0xf0 0xbf 0xbf 0xbf) まで
  • Loading branch information
zmatsuo committed Oct 30, 2024
1 parent ca8d200 commit aa7d0dc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions doc/en/html/about/history.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ <h3 id="teraterm_5.4">YYYY.MM.DD (Ver 5.4 not released yet)</h3>
<li>MACRO: Improved the issue where DPI scaling was not properly adjusted when the dialog spans across monitors with different scaling factors.</li>
<li>Unnecessary overwrite confirmation dialog is no longer displayed when selecting a existing file as a log file at file selecting dialog box.</li>
<li>MACRO: Fixed TTL cannot be execute when it is UTF-8 without BOM.</li>
<li>Fixed to handle U+20000 to U+3FFFF of UTF-8.</li>
</ul>
</li>

Expand Down
1 change: 1 addition & 0 deletions doc/ja/html/about/history.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ <h3 id="teraterm_5.4">YYYY.MM.DD (Ver 5.4 not released yet)</h3>
<li>MACRO: ダイアログが拡大/縮小率の異なるモニタをまたぐ時、DPI調整がうまく行われない問題を改善した。</li>
<li>ログファイルとしてファイル選択ダイアログで既存のファイルを指定した時に上書き確認ダイアログを表示しないようにした。</li>
<li>MACRO: TTL ファイルが BOM なし UTF-8 の場合、実行できない問題を修正した。</li>
<li>UTF-8 の U+20000 から U+3FFFF を正しく扱うよう修正した。</li>
</ul>
</li>

Expand Down
2 changes: 1 addition & 1 deletion teraterm/teraterm/charset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ static BOOL ParseFirstUTF8(CharSetData *w, BYTE b)
// 4byte(21bit)
assert(w->count == 4);
assert((w->buf[0] & 0xf8) == 0xf0);
if ((w->buf[0] == 0xf0 && (w->buf[1] < 0x90 || 0x9f < w->buf[1])) ||
if ((w->buf[0] == 0xf0 && (w->buf[1] < 0x90 || 0xbf < w->buf[1])) ||
(w->buf[0] == 0xf4 && (w->buf[1] < 0x80 || 0x8f < w->buf[1]))) {
// 不正な UTF-8
PutReplacementChr(w, w->buf, 3, ts.FallbackToCP932);
Expand Down

0 comments on commit aa7d0dc

Please sign in to comment.