Paste Unicode characters into IntelliJ source code editor in a string without converting to Unicode code point numbers

Viewed 1167

In the IntelliJ 2019.2 code editor, if I paste this entire line:

String abc = "AZ" ; 

The KIWIFRUIT character stays intact. Good.

But if I start with this line:

String abc = "AZ";  // Before pasting

…and paste the single character in between the A and the Z of the string, the KIWIFRUIT is replaced with the UTF-16 representation of the character as a pair of high surrogate and low surrogate numbers: \uD83E\uDD5D.

String abc = "A\uD83E\uDD5DZ" ; 

I understand that this pair of hex numbers is just an alternate way to represent the KIWIFRUIT character. But I would rather see the single character in my source code.

I have verified the .java is configured within IntelliJ to be UTF-8. And as I have shown, pasting the entire line results in the green emoji glyph being displayed within the code editor.

➥ Is there some way to turn off IntelliJ’s converting of high-numbered Unicode characters into a hex string?

1 Answers

Use Edit | Paste as Plain Text (Paste without Formatting or Past Simple if you are using an older IDE version)

Mac: Alt+Shift+Cmd+V

PC: Alt+Shift+Ctrl+V

Related