Accepted Encoding
A Visual Studio Code extension that alerts when the encoding of an open file does not match the defined configuration.
Features
- Automatic encoding mismatch detection: Monitors open files and detects when their actual encoding does not match the expected configuration
- Visual status bar indicator: Displays an alert indicator in the VS Code status bar when a mismatch is detected
- Configurable warning messages: Shows alert notifications with details about the expected vs. actual encoding
Installation
- Open VS Code
- Go to the Extensions view (
Ctrl+Shift+X / Cmd+Shift+X)
- Search for "Accepted Encodings"
- Click Install
Usage
Once installed, the extension works automatically. When you open a file whose encoding does not match your files.encoding configuration:
- An alert indicator will appear in the status bar (if enabled)
- You will receive a warning notification with details and re-opening options (if enabled)
- You can check encoding anytime with the context menu item "Check Encoding Mismatch"
Example
If your configuration expects UTF-8 but you open a file with windows-1252 encoding:
Encoding mismatch in "file.txt": expected "utf8" but found "windows1252"
Configuration
The extension provides the following configuration options in settings.json:
AcceptedEncodings.show_message_box
- Type:
boolean
- Default:
true
- Description: Show warning messages when file encoding doesn't match the configured encoding
{
"AcceptedEncodings.showErrorMessages": true
}
AcceptedEncodings.show_status_bar
- Type:
boolean
- Default:
true
- Description: Show a status bar indicator when encoding mismatch is detected
{
"AcceptedEncodings.show_status_bar": true
}
AcceptedEncodings.accepted_encodings
- Type:
string
- Default:
iso88597,utf8
- Description: List of accepted encodings separated by comma
{
"AcceptedEncodings.accepted_encodings": "iso88597,utf8"
}
Feedback and Contributions
Feature suggestions and contributions are welcome. You can:
- Report issues
- Suggest new features
- Submit pull requests with improvements
Enjoying the extension? Consider leaving a review or starring the repository.