Skip to content

A Visual Studio Extension to display current file encoding or change it.

License

Notifications You must be signed in to change notification settings

myvas/Vsix_FileEncoding

 
 

Repository files navigation

FileEncoding

中文 | English

What's this?

This Visual Studio Extension will display the charset of current document at the right bottom margin of the editor; Click to popup a contextual menu with a list of encodings and choose the encoding that you want to convert the document to.

Multi-targeting:

  • Visual Studio 2022 (17.x)
  • Visual Studio 2019 (16.x)

NOTES:

  1. The file's modification status will be changed to dirty (aka Modified), since you'd changed the encoding of the file.
  2. UTF-8 as default: When the encoding could be regarded as both UTF-8 and the locale default encoding (e.g. GB2312), this app will take it as UTF-8 instead of the locale default.

Screenshots

Preview

NOTES:

  • UTF-8 (without BOM)
    • html|xhtml|_Layout.cshtml: It is not necessary to use a BOM if a output template has already pointed out its charset=utf-8.
    • PHP: In case of PHP files are usually as a template to output, it is not a good idea to save PHP files with the BOM at the beginning. Do not add BOM to a script file that cannot be correctly processed by its interpretor.
    • JSON: Implementations must not add a byte order mark to the beginning of a JSON text. [RFC 7159, Section 8.1]
    • sh: POSIX (Unix-like) scripts are required to start with '#!' (e.g. #!/bin/sh, #!/bin/bash), so you MUST NOT add a BOM to the beginning.
  • UTF-8 BOM
    • IMHO, it is recommended for a document without an indicator of charset or reader, and it posiblbly contains multi-byte characters, for two reasons:
      1. BOM is actually the most efficient way of identifying an UTF-8 file.
      2. Most modern applications and standards support and encourage the use of BOM.

License

MIT License

Copyright (c) 2021 genrwoody
Copyright (c) 2022 Myvas Foundation

This repo was forked from FileEncoding by genrwoody; This release version solved an issue of confusing display for locale encoding and re-publish by Myvas Foundation.

See README for details.

About

A Visual Studio Extension to display current file encoding or change it.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 97.6%
  • Batchfile 2.4%