Search code examples
encodingsublimetext2sublimetextsublimetext3sublime-text-plugin

How to transform ISO-8859-1 chars into Entity Names in Sublime Text?


Is there a plugin to Sublime Text that changes ISO-8859-1 chars like "á é í ó ú" in Entity Names codes "á é í ó ú"?

My code is entirely developed in UTF8 but I need to change to ISO encoding.


Solution

  • Check out the StringEncode plugin, available via Package Control. Among other things, it can convert between characters and HTML entities. By default, the various commands are available through the Command Palette, but you can also create custom keymaps if you wish. For example, to bind CtrlAltShiftE to the html_entitize command, select Preferences -> Key Bindings-User and add the following:

    { "keys": ["ctrl+alt+shift+e"], "command": "html_entitize" }
    

    If the file is empty, surround the key binding with square brackets [ ]. Save the file, and you can now select the characters you'd like to convert to HTML entities, hit the key combo, and they'll be converted:

    characters

    to

    entities