Skip to content

feat: Add custom encoding support (CP949, CP936, UTF-16) and fix encoding/rendering bugs#49

Closed
stdust wants to merge 4 commits into
mentebinaria:mainfrom
stdust:feat/custom-encoding
Closed

feat: Add custom encoding support (CP949, CP936, UTF-16) and fix encoding/rendering bugs#49
stdust wants to merge 4 commits into
mentebinaria:mainfrom
stdust:feat/custom-encoding

Conversation

@stdust

@stdust stdust commented Jul 14, 2026

Copy link
Copy Markdown

Summary

This PR adds support for custom encodings (CP949, CP936, UTF-16 LE/BE) to the Hex view's ASCII panel. It also fixes file corruption issues caused by unmappable characters, and resolves rendering/panic bugs related to multi-byte characters spanning across 16-byte row boundaries.

Changes

  • Encoding dialog (dialog_encoding.rs): Added CP949, CP936, and UTF-16 encodings to the selection list.
  • Rendering logic (draw.rs): Rewrote the ASCII hex rendering function to decode the entire page buffer at once instead of decoding per-line. This prevents multi-byte characters that span row boundaries from getting split and garbled.
  • Input protection (util.rs / edit.rs): Prevented encoding_rs from inserting HTML entities (like 안) into the file when typing unmappable characters. Now it cleanly writes a single ? replacement byte instead.

@stdust
stdust force-pushed the feat/custom-encoding branch from 345e366 to 8ed153a Compare July 15, 2026 09:15
@stdust stdust closed this Jul 16, 2026
@stdust
stdust deleted the feat/custom-encoding branch July 16, 2026 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant