Skip to content

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

Open
stdust wants to merge 4 commits into
mentebinaria:mainfrom
stdust:feat/encoding-layout
Open

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

Conversation

@stdust

@stdust stdust commented Jul 16, 2026

Copy link
Copy Markdown

Added custom encoding support (including CP949, CP936, UTF-16 LE/BE) to hex view ASCII panel using Paragraph widget to prevent character clipping, dynamically positioning the select dialog based on terminal height, and fixed keyboard input and out of bounds panics for small files.

Key Changes

  • Custom Encoding Support: Added CP949, CP936, UTF-16-LE, and UTF-16-BE support to Hex view.
  • Dynamic Dialog Layout: Shifted the encoding selection dialog position upwards dynamically (height / 12 offset) rather than using a hardcoded value, preventing layout clipping.
  • Rendering Fix (draw.rs / dialog_encoding.rs): Refactored the ASCII draw function to decode the entire page space 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.

@merces

merces commented Jul 16, 2026

Copy link
Copy Markdown
Member

Hi. I appreciate your willing to help. I have a few comments/questions.

  1. It introduces new features, fixes bugs, improve code, etc. These are too many things for a single PR.
  2. Why remove my code comments?
  3. We didn't discuss the addition of encoding support in Hex view. Also, it doesn't seem to work well. Example:

UTF-8:
image

UTF-16-LE:
image

Please notice we don't accept vibe-coded PRs. See https://github.com/mentebinaria/dz6?tab=contributing-ov-file.

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.

2 participants