首页 > 解决方案 > Stop IntelliJ code editor from escaping pasted string literal characters

问题描述

What I want:

String x = "" ;

What I get in Apple TextEdit 1.16 text editor app when clicking from the macOS "Show Emojis & Symbols" floating windoid:

String x = "" ;

Problem 1

What I get in IntelliJ 2021.2.2 code editor when clicking from the macOS "Show Emojis & Symbols" floating windoid:

String x = "ð" ;

Update: This appears to be a currently known bug. See issue page IDEA-278540 Emoji in OSX are rendered as another unicode, as noted in Answer by Konstantin Annikov.

Problem 2

What I get in IntelliJ 2021.2.2 code editor when pasting that character copied from TextEdit app:

String x = "\uD83D\uDE37" ;

Presumably the issue revolves around Unicode characters outside the Basic Multilingual Plane.

➯ Is there any way to make the IntelliJ code editor accept such characters directly, without escaping?

标签: javaintellij-ideaunicodestring-literalscode-editor

解决方案


这是 IntelliJ IDEA 中的回归。有关详细信息,请参阅https://youtrack.jetbrains.com/issue/IDEA-278540


推荐阅读