ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Convert​To​UTF8

by seanliang ALL Top 25

A Sublime Text 2 & 3 plugin for editing and saving files encoded in GBK, BIG5, EUC-KR, EUC-JP, Shift_JIS, etc.

Details

Installs

  • Total 1.35M
  • Win 1.00M
  • Mac 267K
  • Linux 83K
Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13 Mar 12 Mar 11 Mar 10 Mar 9 Mar 8 Mar 7 Mar 6 Mar 5 Mar 4 Mar 3 Mar 2 Mar 1 Feb 28 Feb 27 Feb 26 Feb 25 Feb 24 Feb 23 Feb 22 Feb 21 Feb 20 Feb 19 Feb 18 Feb 17 Feb 16 Feb 15 Feb 14 Feb 13 Feb 12 Feb 11 Feb 10 Feb 9
Windows 3 131 108 71 59 104 108 138 140 128 52 106 105 121 117 167 160 66 95 112 123 118 129 109 74 80 102 125 129 137 106 59 79 98 101 101 103 124 66 88 92 105 95 117 109 62
Mac 0 30 23 11 18 20 26 24 32 31 10 16 22 30 21 23 18 16 17 33 33 17 32 30 11 14 18 23 27 22 23 20 12 20 20 14 17 29 12 8 15 18 18 22 20 21
Linux 0 5 2 2 1 5 6 4 9 3 7 8 8 4 4 7 8 3 6 11 11 5 5 5 5 8 5 9 4 7 10 6 7 6 1 8 8 5 3 4 6 6 5 5 4 3
050100150Mar 26Mar 23Mar 20Mar 17Mar 14Mar 11Mar 8Mar 5Mar 2Feb 27Feb 24Feb 21Feb 18Feb 15Feb 12Feb 9Mar 26 Linux: 0 Mac: 0 Windows: 3Mar 25 Linux: 5 Mac: 30 Windows: 131Mar 24 Linux: 2 Mac: 23 Windows: 108Mar 23 Linux: 2 Mac: 11 Windows: 71Mar 22 Linux: 1 Mac: 18 Windows: 59Mar 21 Linux: 5 Mac: 20 Windows: 104Mar 20 Linux: 6 Mac: 26 Windows: 108Mar 19 Linux: 4 Mac: 24 Windows: 138Mar 18 Linux: 9 Mac: 32 Windows: 140Mar 17 Linux: 3 Mac: 31 Windows: 128Mar 16 Linux: 7 Mac: 10 Windows: 52Mar 15 Linux: 8 Mac: 16 Windows: 106Mar 14 Linux: 8 Mac: 22 Windows: 105Mar 13 Linux: 4 Mac: 30 Windows: 121Mar 12 Linux: 4 Mac: 21 Windows: 117Mar 11 Linux: 7 Mac: 23 Windows: 167Mar 10 Linux: 8 Mac: 18 Windows: 160Mar 9 Linux: 3 Mac: 16 Windows: 66Mar 8 Linux: 6 Mac: 17 Windows: 95Mar 7 Linux: 11 Mac: 33 Windows: 112Mar 6 Linux: 11 Mac: 33 Windows: 123Mar 5 Linux: 5 Mac: 17 Windows: 118Mar 4 Linux: 5 Mac: 32 Windows: 129Mar 3 Linux: 5 Mac: 30 Windows: 109Mar 2 Linux: 5 Mac: 11 Windows: 74Mar 1 Linux: 8 Mac: 14 Windows: 80Feb 28 Linux: 5 Mac: 18 Windows: 102Feb 27 Linux: 9 Mac: 23 Windows: 125Feb 26 Linux: 4 Mac: 27 Windows: 129Feb 25 Linux: 7 Mac: 22 Windows: 137Feb 24 Linux: 10 Mac: 23 Windows: 106Feb 23 Linux: 6 Mac: 20 Windows: 59Feb 22 Linux: 7 Mac: 12 Windows: 79Feb 21 Linux: 6 Mac: 20 Windows: 98Feb 20 Linux: 1 Mac: 20 Windows: 101Feb 19 Linux: 8 Mac: 14 Windows: 101Feb 18 Linux: 8 Mac: 17 Windows: 103Feb 17 Linux: 5 Mac: 29 Windows: 124Feb 16 Linux: 3 Mac: 12 Windows: 66Feb 15 Linux: 4 Mac: 8 Windows: 88Feb 14 Linux: 6 Mac: 15 Windows: 92Feb 13 Linux: 6 Mac: 18 Windows: 105Feb 12 Linux: 5 Mac: 18 Windows: 95Feb 11 Linux: 5 Mac: 22 Windows: 117Feb 10 Linux: 4 Mac: 20 Windows: 109Feb 9 Linux: 3 Mac: 21 Windows: 62Mar 26 Linux: 0 Mac: 0 Windows: 3Mar 25 Linux: 5 Mac: 30 Windows: 131Mar 24 Linux: 2 Mac: 23 Windows: 108Mar 23 Linux: 2 Mac: 11 Windows: 71Mar 22 Linux: 1 Mac: 18 Windows: 59Mar 21 Linux: 5 Mac: 20 Windows: 104Mar 20 Linux: 6 Mac: 26 Windows: 108Mar 19 Linux: 4 Mac: 24 Windows: 138Mar 18 Linux: 9 Mac: 32 Windows: 140Mar 17 Linux: 3 Mac: 31 Windows: 128Mar 16 Linux: 7 Mac: 10 Windows: 52Mar 15 Linux: 8 Mac: 16 Windows: 106Mar 14 Linux: 8 Mac: 22 Windows: 105Mar 13 Linux: 4 Mac: 30 Windows: 121Mar 12 Linux: 4 Mac: 21 Windows: 117Mar 11 Linux: 7 Mac: 23 Windows: 167Mar 10 Linux: 8 Mac: 18 Windows: 160Mar 9 Linux: 3 Mac: 16 Windows: 66Mar 8 Linux: 6 Mac: 17 Windows: 95Mar 7 Linux: 11 Mac: 33 Windows: 112Mar 6 Linux: 11 Mac: 33 Windows: 123Mar 5 Linux: 5 Mac: 17 Windows: 118Mar 4 Linux: 5 Mac: 32 Windows: 129Mar 3 Linux: 5 Mac: 30 Windows: 109Mar 2 Linux: 5 Mac: 11 Windows: 74Mar 1 Linux: 8 Mac: 14 Windows: 80Feb 28 Linux: 5 Mac: 18 Windows: 102Feb 27 Linux: 9 Mac: 23 Windows: 125Feb 26 Linux: 4 Mac: 27 Windows: 129Feb 25 Linux: 7 Mac: 22 Windows: 137Feb 24 Linux: 10 Mac: 23 Windows: 106Feb 23 Linux: 6 Mac: 20 Windows: 59Feb 22 Linux: 7 Mac: 12 Windows: 79Feb 21 Linux: 6 Mac: 20 Windows: 98Feb 20 Linux: 1 Mac: 20 Windows: 101Feb 19 Linux: 8 Mac: 14 Windows: 101Feb 18 Linux: 8 Mac: 17 Windows: 103Feb 17 Linux: 5 Mac: 29 Windows: 124Feb 16 Linux: 3 Mac: 12 Windows: 66Feb 15 Linux: 4 Mac: 8 Windows: 88Feb 14 Linux: 6 Mac: 15 Windows: 92Feb 13 Linux: 6 Mac: 18 Windows: 105Feb 12 Linux: 5 Mac: 18 Windows: 95Feb 11 Linux: 5 Mac: 22 Windows: 117Feb 10 Linux: 4 Mac: 20 Windows: 109Feb 9 Linux: 3 Mac: 21 Windows: 62Mar 26 Linux: 0 Mac: 0 Windows: 3Mar 25 Linux: 5 Mac: 30 Windows: 131Mar 24 Linux: 2 Mac: 23 Windows: 108Mar 23 Linux: 2 Mac: 11 Windows: 71Mar 22 Linux: 1 Mac: 18 Windows: 59Mar 21 Linux: 5 Mac: 20 Windows: 104Mar 20 Linux: 6 Mac: 26 Windows: 108Mar 19 Linux: 4 Mac: 24 Windows: 138Mar 18 Linux: 9 Mac: 32 Windows: 140Mar 17 Linux: 3 Mac: 31 Windows: 128Mar 16 Linux: 7 Mac: 10 Windows: 52Mar 15 Linux: 8 Mac: 16 Windows: 106Mar 14 Linux: 8 Mac: 22 Windows: 105Mar 13 Linux: 4 Mac: 30 Windows: 121Mar 12 Linux: 4 Mac: 21 Windows: 117Mar 11 Linux: 7 Mac: 23 Windows: 167Mar 10 Linux: 8 Mac: 18 Windows: 160Mar 9 Linux: 3 Mac: 16 Windows: 66Mar 8 Linux: 6 Mac: 17 Windows: 95Mar 7 Linux: 11 Mac: 33 Windows: 112Mar 6 Linux: 11 Mac: 33 Windows: 123Mar 5 Linux: 5 Mac: 17 Windows: 118Mar 4 Linux: 5 Mac: 32 Windows: 129Mar 3 Linux: 5 Mac: 30 Windows: 109Mar 2 Linux: 5 Mac: 11 Windows: 74Mar 1 Linux: 8 Mac: 14 Windows: 80Feb 28 Linux: 5 Mac: 18 Windows: 102Feb 27 Linux: 9 Mac: 23 Windows: 125Feb 26 Linux: 4 Mac: 27 Windows: 129Feb 25 Linux: 7 Mac: 22 Windows: 137Feb 24 Linux: 10 Mac: 23 Windows: 106Feb 23 Linux: 6 Mac: 20 Windows: 59Feb 22 Linux: 7 Mac: 12 Windows: 79Feb 21 Linux: 6 Mac: 20 Windows: 98Feb 20 Linux: 1 Mac: 20 Windows: 101Feb 19 Linux: 8 Mac: 14 Windows: 101Feb 18 Linux: 8 Mac: 17 Windows: 103Feb 17 Linux: 5 Mac: 29 Windows: 124Feb 16 Linux: 3 Mac: 12 Windows: 66Feb 15 Linux: 4 Mac: 8 Windows: 88Feb 14 Linux: 6 Mac: 15 Windows: 92Feb 13 Linux: 6 Mac: 18 Windows: 105Feb 12 Linux: 5 Mac: 18 Windows: 95Feb 11 Linux: 5 Mac: 22 Windows: 117Feb 10 Linux: 4 Mac: 20 Windows: 109Feb 9 Linux: 3 Mac: 21 Windows: 62

Readme

Source
raw.​githubusercontent.​com

Description (中文说明见README.zh_CN.md)

With this plugin, you can edit and save the files which encodings are not supported by Sublime Text currently, especially for those used by CJK users, such as GB2312, GBK, BIG5, EUC-KR, EUC-JP, etc. ConvertToUTF8 supports both Sublime Text 2 and 3.

ConvertToUTF8

If you want to support this plugin, you can donate via Alipay or WeChat. Thanks! :)

Alipay QR code WeChat QR code

Note

** Windows 7 (Sublime Text 3): When Windows DPI Scaling is set to a value higher than 100%, the file name might not be displayed correctly, please try to add "dpi_scale": 1 to User Settings of Sublime Text.

** Linux (Sublime Text 2 & 3) and OSX (Sublime Text 3): You will need to install an extra plugin to make ConvertToUTF8 work properly: Codecs26 for Sublime Text 2 or Codecs33 for Sublime Text 3.

Installation

Using Package Control to find, install and upgrade ConvertToUTF8 is the recommended method to install this plug-in.

Otherwise, you can download this repository as a zip file, unzip it, and rename the new folder to ConvertToUTF8, then move this folder to Packages folder of Sublime Text (You can find the Packages folder by clicking “Preferences > Browse Packages” menu entry in Sublime Text).

Your folder hierarchy should look like this:

Folder Hierarchy

Configuration

Please check ConvertToUTF8.sublime-settings file for details. You should save your personal settings in a file named “ConvertToUTF8.sublime-settings” under “User” folder. You can set project-specific settings (except encoding_list and max_cache_size) in the .sublime-project file which can be opened via “Project > Edit Project” menu.

  • encoding_list: encoding selection list when detection is failed
  • reset_diff_markers: reset diff markers after converting (default: true)
  • max_cache_size: maximum encoding cache size, 0 means no cache (default: 100)
  • max_detect_lines: maximum detection lines, 0 means unlimited (default: 600)
  • preview_action: convert the file's content to UTF-8 when previewing it (default: false)
  • default_encoding_on_create: specific the default encoding for newly created file (such as “GBK”), empty value means using sublime text's “default_encoding” setting (default: “”)
  • convert_on_load: convert the file's content to UTF-8 when it is loaded (default: true)
  • convert_on_save: convert the file's content from UTF-8 to its original (or specific) encoding when it is saved (default: true)
  • convert_on_find: convert the text in Find Results view to UTF-8 (default: false)
  • lazy_reload: save file to a temporary location, and reload it in background when switching to other windows or tabs (default: false)
  • confidence: the minimum confidence rate which the converting will be performed automatic. (default: 0.95)

Usage

In most cases, this plug-in will take care of encoding issues automatically.

You can also use the “File > Set File Encoding to” menu entry to transform between different encodings. For example, you can open a UTF-8 file, and save it to GBK, and vice versa.

Note: * if convert_on_save is set to false, the file will NEVER be saved to the selected encoding * please do not edit the file before the encoding detection process is finished * please try either increasing the value of max_detect_lines or set the encoding manually if the detection result is not accurate * due to limitation of API, when lazy_reload is set to true, quit Sublime Text immediately after saving a file will cause the file to be saved as UTF-8, the correct content will be reload next time Sublime Text starts

Q & A

  • Q: It is not working after installation, how do I fix it?

A: Please try the following steps: 1. Restart Sublime Text 2. Make sure the plug-in folder is named “ConvertToUTF8” (skip this step if you install via “Package Control”) 3. See Note section above 4. Disable other encoding related plug-ins 5. Contact me

  • Q: Which encodings are supported?

A: Any encoding supported by Python will be fine, other encodings like EUC-TW will not be supported.

  • Q: Why does the content become a mess when the window is re-activated?

A: This is caused by reloading and has been fixed, please update your ConvertToUTF8 to latest version.

  • Q: Why does ST2 ask me that file “Has changed on disk. Do you want to reload it?” when the window is re-activated.

A: Same reason as above. Please choose “Cancel” if you have unsaved changes to the file.

  • Q: When saving the file, Sublime Text tells me the file is saved as UTF-8, why?

A: Don't worry, the plug-in will convert your file to original encoding.

  • Q: My file was saved as UTF-8 and it's in a mess, how can I recover it?

A: Please open the file and make sure its encoding is UTF-8, then choose the menu entry “File > Save with Encoding > Western (Windows 1252)”, close and reopen this file.

Contact me

Please send me your questions or suggestions: sunlxy (at) yahoo.com or http://weibo.com/seanliang