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

String​Encode

Converts characters from one encoding to another using a transformation (think HTML entities, not character encodings).

Details

  • 2 2016.11.07.18.09.47
    3 2.2.2
  • github.​com
  • github.​com
  • 12 months ago
  • 2 hours ago
  • 6 years ago

Installs

  • Total 22K
  • Win 10K
  • OS X 9K
  • Linux 2K
Oct 22 Oct 21 Oct 20 Oct 19 Oct 18 Oct 17 Oct 16 Oct 15 Oct 14 Oct 13 Oct 12 Oct 11 Oct 10 Oct 9 Oct 8 Oct 7 Oct 6 Oct 5 Oct 4 Oct 3 Oct 2 Oct 1 Sep 30 Sep 29 Sep 28 Sep 27 Sep 26 Sep 25 Sep 24 Sep 23 Sep 22 Sep 21 Sep 20 Sep 19 Sep 18 Sep 17 Sep 16 Sep 15 Sep 14 Sep 13 Sep 12 Sep 11 Sep 10 Sep 9 Sep 8 Sep 7
Windows 3 3 12 11 11 10 7 2 1 6 8 8 12 7 4 6 12 9 10 6 6 1 7 12 11 6 12 9 1 1 11 15 13 12 19 6 6 10 13 11 15 4 0 3 3 4
OS X 3 4 4 6 9 5 14 2 1 5 6 3 10 7 3 7 10 6 8 9 7 4 2 8 7 10 7 5 2 1 5 12 9 11 5 0 4 10 8 9 10 3 1 3 7 10
Linux 2 1 3 2 1 3 2 0 1 1 1 2 3 1 0 1 1 2 2 2 4 2 0 1 1 3 5 4 2 0 4 2 2 3 2 1 1 2 1 1 3 1 0 0 1 3

Readme

Source
raw.​githubusercontent.​com

StringEncode

Encodes text. “Encode” in this context refers to HTML entities or URL encoding, not character encodings. Most of these commands work in both directions (e.g. you can encode to html entities, or from html entities).

  • Html entities
  • Css (e.g. unicode characters)
  • Xml entities
  • Json strings
  • Urls
  • Base64 encoding
  • Hash: Md5, Sha256, Sha512
  • Regex escape
  • SQL 'LIKE' escape
  • Hexadecimal / Decimal
  • Unicode Hexadecimal representation

This plugin was intended to be used with selections, but if you don't have any text selected, it will act on the entire document. This can be handy (if you're base64-encoding a file, for instance), but also have unintended consequences. For instance, you probably should not use URL Decode on an entire text document.

You can also encode the clipboard, use the string_encode_paste command, and you will be presented with a menu to choose the encoding, and the clipboard will be encoded and inserted.

Installation

  1. Using Package Control, install “StringEncode”

Or:

  1. Open the Sublime Text Packages folder

    • OS X: ~/Library/Application Support/Sublime Text 3/Packages/
    • Windows: %APPDATA%/Sublime Text 3/Packages/
    • Linux: ~/.Sublime Text 3/Packages/ or ~/.config/sublime-text-3/Packages
  2. clone this repo

  3. Install keymaps for the commands (see Example.sublime-keymap for my preferred keys)

Commands

string_encode_paste: Converts the clipboard to the desired encoding.

html_entitize: Converts characters to their HTML entity

html_deentitize: Converts HTML entities to a character

url_encode: Uses urllib.quote to escape special URL characters. - Accepts an old_school argument (default: True). Setting it to False will return %20 instead of + when encoding spaces.

url_decode: Uses urllib.unquote to convert escaped URL characters

json_escape: Escapes a string and surrounds it in quotes, according to the JSON encoding.

json_unescape: Unescapes a string (include the quotes!) according to JSON encoding.

base64_encode: Uses base64 to encode into base64

base64_decode: Uses base64 to decode from base64

md5_encode: Uses sha package to create md5 hash

sha256_encode: Uses sha package to create sha256 hash

sha512_encode: Uses sha package to create sha512 hash

escape_regex: Escapes regex meta characters

escape_like: Escapes SQL-LIKE meta characters

safe_html_entitize: Converts characters to their HTML entity, but preserves HTML reserved characters

safe_html_deentitize: Converts HTML entities to a character, but preserves HTML reserved characters

xml_entitize: Converts characters to their XML entity

xml_deentitize: Converts XML entities to a character