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

  • 1.2.14
  • github.​com
  • github.​com
  • 4 years ago
  • 19 minutes ago
  • 13 years ago

Installs

  • Total 1.36M
  • Win 1.01M
  • Mac 268K
  • Linux 84K
Jun 30 Jun 29 Jun 28 Jun 27 Jun 26 Jun 25 Jun 24 Jun 23 Jun 22 Jun 21 Jun 20 Jun 19 Jun 18 Jun 17 Jun 16 Jun 15 Jun 14 Jun 13 Jun 12 Jun 11 Jun 10 Jun 9 Jun 8 Jun 7 Jun 6 Jun 5 Jun 4 Jun 3 Jun 2 Jun 1 May 31 May 30 May 29 May 28 May 27 May 26 May 25 May 24 May 23 May 22 May 21 May 20 May 19 May 18 May 17 May 16
Windows 71 56 52 96 106 95 95 91 48 67 86 102 89 88 93 53 61 88 90 112 86 108 57 55 91 100 115 97 70 43 62 96 116 120 85 111 62 89 94 132 89 88 59 20 52 97
Mac 18 12 15 26 18 19 24 26 11 17 15 22 35 17 28 10 11 19 15 17 27 22 10 7 12 31 20 27 13 10 15 20 30 26 22 18 13 14 28 34 27 16 7 4 5 19
Linux 7 5 4 2 2 6 6 4 4 1 2 7 2 9 6 2 5 6 4 6 3 3 5 3 9 7 3 2 3 4 3 10 10 3 7 5 3 2 4 4 6 2 1 2 3 4
050100150Jun 30Jun 27Jun 24Jun 21Jun 18Jun 15Jun 12Jun 9Jun 6Jun 3May 31May 28May 25May 22May 19May 16Jun 30 Linux: 7 Mac: 18 Windows: 71Jun 29 Linux: 5 Mac: 12 Windows: 56Jun 28 Linux: 4 Mac: 15 Windows: 52Jun 27 Linux: 2 Mac: 26 Windows: 96Jun 26 Linux: 2 Mac: 18 Windows: 106Jun 25 Linux: 6 Mac: 19 Windows: 95Jun 24 Linux: 6 Mac: 24 Windows: 95Jun 23 Linux: 4 Mac: 26 Windows: 91Jun 22 Linux: 4 Mac: 11 Windows: 48Jun 21 Linux: 1 Mac: 17 Windows: 67Jun 20 Linux: 2 Mac: 15 Windows: 86Jun 19 Linux: 7 Mac: 22 Windows: 102Jun 18 Linux: 2 Mac: 35 Windows: 89Jun 17 Linux: 9 Mac: 17 Windows: 88Jun 16 Linux: 6 Mac: 28 Windows: 93Jun 15 Linux: 2 Mac: 10 Windows: 53Jun 14 Linux: 5 Mac: 11 Windows: 61Jun 13 Linux: 6 Mac: 19 Windows: 88Jun 12 Linux: 4 Mac: 15 Windows: 90Jun 11 Linux: 6 Mac: 17 Windows: 112Jun 10 Linux: 3 Mac: 27 Windows: 86Jun 9 Linux: 3 Mac: 22 Windows: 108Jun 8 Linux: 5 Mac: 10 Windows: 57Jun 7 Linux: 3 Mac: 7 Windows: 55Jun 6 Linux: 9 Mac: 12 Windows: 91Jun 5 Linux: 7 Mac: 31 Windows: 100Jun 4 Linux: 3 Mac: 20 Windows: 115Jun 3 Linux: 2 Mac: 27 Windows: 97Jun 2 Linux: 3 Mac: 13 Windows: 70Jun 1 Linux: 4 Mac: 10 Windows: 43May 31 Linux: 3 Mac: 15 Windows: 62May 30 Linux: 10 Mac: 20 Windows: 96May 29 Linux: 10 Mac: 30 Windows: 116May 28 Linux: 3 Mac: 26 Windows: 120May 27 Linux: 7 Mac: 22 Windows: 85May 26 Linux: 5 Mac: 18 Windows: 111May 25 Linux: 3 Mac: 13 Windows: 62May 24 Linux: 2 Mac: 14 Windows: 89May 23 Linux: 4 Mac: 28 Windows: 94May 22 Linux: 4 Mac: 34 Windows: 132May 21 Linux: 6 Mac: 27 Windows: 89May 20 Linux: 2 Mac: 16 Windows: 88May 19 Linux: 1 Mac: 7 Windows: 59May 18 Linux: 2 Mac: 4 Windows: 20May 17 Linux: 3 Mac: 5 Windows: 52May 16 Linux: 4 Mac: 19 Windows: 97Jun 30 Linux: 7 Mac: 18 Windows: 71Jun 29 Linux: 5 Mac: 12 Windows: 56Jun 28 Linux: 4 Mac: 15 Windows: 52Jun 27 Linux: 2 Mac: 26 Windows: 96Jun 26 Linux: 2 Mac: 18 Windows: 106Jun 25 Linux: 6 Mac: 19 Windows: 95Jun 24 Linux: 6 Mac: 24 Windows: 95Jun 23 Linux: 4 Mac: 26 Windows: 91Jun 22 Linux: 4 Mac: 11 Windows: 48Jun 21 Linux: 1 Mac: 17 Windows: 67Jun 20 Linux: 2 Mac: 15 Windows: 86Jun 19 Linux: 7 Mac: 22 Windows: 102Jun 18 Linux: 2 Mac: 35 Windows: 89Jun 17 Linux: 9 Mac: 17 Windows: 88Jun 16 Linux: 6 Mac: 28 Windows: 93Jun 15 Linux: 2 Mac: 10 Windows: 53Jun 14 Linux: 5 Mac: 11 Windows: 61Jun 13 Linux: 6 Mac: 19 Windows: 88Jun 12 Linux: 4 Mac: 15 Windows: 90Jun 11 Linux: 6 Mac: 17 Windows: 112Jun 10 Linux: 3 Mac: 27 Windows: 86Jun 9 Linux: 3 Mac: 22 Windows: 108Jun 8 Linux: 5 Mac: 10 Windows: 57Jun 7 Linux: 3 Mac: 7 Windows: 55Jun 6 Linux: 9 Mac: 12 Windows: 91Jun 5 Linux: 7 Mac: 31 Windows: 100Jun 4 Linux: 3 Mac: 20 Windows: 115Jun 3 Linux: 2 Mac: 27 Windows: 97Jun 2 Linux: 3 Mac: 13 Windows: 70Jun 1 Linux: 4 Mac: 10 Windows: 43May 31 Linux: 3 Mac: 15 Windows: 62May 30 Linux: 10 Mac: 20 Windows: 96May 29 Linux: 10 Mac: 30 Windows: 116May 28 Linux: 3 Mac: 26 Windows: 120May 27 Linux: 7 Mac: 22 Windows: 85May 26 Linux: 5 Mac: 18 Windows: 111May 25 Linux: 3 Mac: 13 Windows: 62May 24 Linux: 2 Mac: 14 Windows: 89May 23 Linux: 4 Mac: 28 Windows: 94May 22 Linux: 4 Mac: 34 Windows: 132May 21 Linux: 6 Mac: 27 Windows: 89May 20 Linux: 2 Mac: 16 Windows: 88May 19 Linux: 1 Mac: 7 Windows: 59May 18 Linux: 2 Mac: 4 Windows: 20May 17 Linux: 3 Mac: 5 Windows: 52May 16 Linux: 4 Mac: 19 Windows: 97Jun 30 Linux: 7 Mac: 18 Windows: 71Jun 29 Linux: 5 Mac: 12 Windows: 56Jun 28 Linux: 4 Mac: 15 Windows: 52Jun 27 Linux: 2 Mac: 26 Windows: 96Jun 26 Linux: 2 Mac: 18 Windows: 106Jun 25 Linux: 6 Mac: 19 Windows: 95Jun 24 Linux: 6 Mac: 24 Windows: 95Jun 23 Linux: 4 Mac: 26 Windows: 91Jun 22 Linux: 4 Mac: 11 Windows: 48Jun 21 Linux: 1 Mac: 17 Windows: 67Jun 20 Linux: 2 Mac: 15 Windows: 86Jun 19 Linux: 7 Mac: 22 Windows: 102Jun 18 Linux: 2 Mac: 35 Windows: 89Jun 17 Linux: 9 Mac: 17 Windows: 88Jun 16 Linux: 6 Mac: 28 Windows: 93Jun 15 Linux: 2 Mac: 10 Windows: 53Jun 14 Linux: 5 Mac: 11 Windows: 61Jun 13 Linux: 6 Mac: 19 Windows: 88Jun 12 Linux: 4 Mac: 15 Windows: 90Jun 11 Linux: 6 Mac: 17 Windows: 112Jun 10 Linux: 3 Mac: 27 Windows: 86Jun 9 Linux: 3 Mac: 22 Windows: 108Jun 8 Linux: 5 Mac: 10 Windows: 57Jun 7 Linux: 3 Mac: 7 Windows: 55Jun 6 Linux: 9 Mac: 12 Windows: 91Jun 5 Linux: 7 Mac: 31 Windows: 100Jun 4 Linux: 3 Mac: 20 Windows: 115Jun 3 Linux: 2 Mac: 27 Windows: 97Jun 2 Linux: 3 Mac: 13 Windows: 70Jun 1 Linux: 4 Mac: 10 Windows: 43May 31 Linux: 3 Mac: 15 Windows: 62May 30 Linux: 10 Mac: 20 Windows: 96May 29 Linux: 10 Mac: 30 Windows: 116May 28 Linux: 3 Mac: 26 Windows: 120May 27 Linux: 7 Mac: 22 Windows: 85May 26 Linux: 5 Mac: 18 Windows: 111May 25 Linux: 3 Mac: 13 Windows: 62May 24 Linux: 2 Mac: 14 Windows: 89May 23 Linux: 4 Mac: 28 Windows: 94May 22 Linux: 4 Mac: 34 Windows: 132May 21 Linux: 6 Mac: 27 Windows: 89May 20 Linux: 2 Mac: 16 Windows: 88May 19 Linux: 1 Mac: 7 Windows: 59May 18 Linux: 2 Mac: 4 Windows: 20May 17 Linux: 3 Mac: 5 Windows: 52May 16 Linux: 4 Mac: 19 Windows: 97

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