开发者

Eclipse shortcut key for replace special characters by unicode escape sequence

开发者 https://www.devze.com 2023-02-22 14:06 出处:网络
Is there a shortcut key in Ecplise that allows to replace an special character (accent开发者_C百科ed) by its unicode escape sequence (\\uXXXX)?There is a plugin with two text fields for simultaneous e

Is there a shortcut key in Ecplise that allows to replace an special character (accent开发者_C百科ed) by its unicode escape sequence (\uXXXX)?


There is a plugin with two text fields for simultaneous escaping to and from unicode.


As an alternative, you can use java editor templates (see Eclipse Preferences -> Java -> Editor -> Templates) and add a template for each special character that you want to replace. For example:

Name: ö
Context: Java
Automatically insert: true
Pattern: \u00F6

Now hit ctrl-space after an occurence of 'ö' in the source code, this will pop up a context menu allowing you to replace it with the unicode escape sequence.


I don't think there is.

The best I can suggest is to run your source files through the native2ascii from the command line. (And then "Refresh" ... )


You didn't tell if you are using Eclipse with Java - in case you are and if you have at some point installed Windowbuilder as well, you can use its automatic code generation to quickly replace all occurrences of special/accented characters within some text with their unicode representation.

Just create some dummy GUI object in Design view (e.g. JLabel), type the string into the text property and you'll get all special characters automatically unicode escaped after switching back to the Source view.

In case you are working in non-Java environment you might keep anoter instance of Eclipse opened - as a handy unicode-escaping-converter.

0

精彩评论

暂无评论...
验证码 换一张
取 消