Search code examples
intellij-ideaidekeyboard-shortcutshtml-encode

Is there a functionality like Sublime's "HTML: Encode Special Characters" in Intellij IDEA


I'm looking something like the functionality given in Sublime Text by the shortcut (windows) Ctrl + Shift + P named "HTML: Encode Special Characters" but in IntelliJ IDEA. This functionality is able to transform this (as a example):

I'm a special character phrase "áéíóú ñ"

Into this:

I'm a special character phrase "áéíóú ñ"

Only by surrounding the specified text and pressing the shortcut key combination given above (again, in windows Ctrl + Shift + P).

Any thoughts?

UPDATE (07-04-2016)

By now, Intellij Idea support this feature natively (version 2016). You need to select the text you want to transform and (in OSX) Cmd+Shift+A and type "Encode" then select the action "Encode XML/HTML Special Characters"

encode Intellij Idea

The only caveats are that this only works (to my knowledge) in html strings.


Solution

  • It is not supported by IntelliJ directly, but a plugin called String Manipulation can help

    From the plugin page:

    Provide actions for text manipulation:

    • Un/Escape selected Java text
    • Un/Escape selected JavaScript text
    • Un/Escape selected HTML text
    • Un/Escape selected XML text
    • Un/Escape selected SQL text
    • Un/Escape selected PHP text
    • Trim selected text
    • Trim all spaces in selected text
    • Remove all spaces in selected text
    • De/Encode selected text as URL
    • Convert selected text to Camel Case
    • Convert selected text to Constant Case
    • Capitalize selected text
    • Encode selected text to MD5 Hex16
    • De/Encode selected text to Base64
    • Remove empty lines
    • Convert non ASCII to escaped Unicode
    • Convert escaped Unicode to String
    • Grep selected text, All lines not matching input text wil be removed. (Does not work in column mode)
    • Increment/Decrement selected text. Duplicate line and increment/decrement all numbers found.