s3lph
s3lph

Reputation: 4655

Stop converting UTF-16 escape literals to the actual character in Android Studio

To keep code clean across different platforms (and due to a bug where one can't use Unicode escape literals like 😁 in XML files), instead of putting actual "non-normal" Unicode characters like U+1F601 (šŸ˜), I usually use \u-escaped UTF-16 surrogate pairs like \ud83d\ude01.

However, when I select and copy String literals containing these escapes from a Java source code file, they are converted to the actual character upon pasting. So when I copy and paste the text

String smile = "\ud83d\ude01";

to another location, it comes out as

String smile = "šŸ˜";

How can I disable this behavior? I didn't find anything in the Settings; or I searched in the wrong place.

Upvotes: 2

Views: 933

Answers (1)

curious_george
curious_george

Reputation: 642

I have not found an option that disables it when pasting; instead, I use the "Paste Simple" option to prevent the escaped Unicode from converting to the actual character.

On a Mac, the keyboard combination for "Paste Simple" is āŒ˜+alt+shift+V

Upvotes: 2

Related Questions