Skip to content

Conversation

@tomopumipumi
Copy link
Contributor

@tomopumipumi tomopumipumi commented Dec 21, 2025

Context / Related PRs This PR is the third part of the encoding support improvements, following:

Summary

This PR implements a status bar item that displays the character encoding of the active buffer (e.g., UTF-8, Shift_JIS). It provides visibility into the file's encoding and indicates the presence of a Byte Order Mark (BOM).

Features

  • Encoding Indicator: Displays the encoding name in the status bar.
  • BOM Support: Appends (BOM) to the encoding name if a BOM is detected (e.g., UTF-8 (BOM)).
  • Configuration: Added active_encoding_button to status_bar settings to toggle visibility (default: true).
  • Settings UI: Added the toggle switch to the Settings UI.
  • Documentation: Updated configuring-zed.md and visual-customization.md.

Implementation Details

  • Created ActiveBufferEncoding component in crates/encoding_selector.
  • The click handler for the button is currently a no-op. Implementing the functionality to reopen files with a specific encoding has potential implications for real-time collaboration (e.g., syncing buffer interpretation across peers). Therefore, this PR focuses strictly on the visualization and configuration aspects to keep the scope simple and focused.
  • Updated schema and default settings to include active_encoding_button.

Screenshots

image image

Configuration

To hide the button, add the following to settings.json:

"status_bar": {
  "active_encoding_button": false
}
image

Heuristic Limitations:

The underlying detection logic (implemented in #44819 and #45243) prioritizes UTF-8 opening performance and does not guarantee perfect detection for all encodings. We consider this margin of error acceptable, similar to the behavior seen in VS Code. A future "Reopen with Encoding" feature would serve as the primary fallback for any misdetections.

Release Notes:

  • Added a status bar item to display the active file's character encoding (e.g. UTF-8) and BOM status.

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Dec 21, 2025
@maxdeviant maxdeviant changed the title feat(status_bar): add encoding indicator status_bar: Add encoding indicator Dec 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant