From 562dfdcbcc882de2c4e17e5b2b57fa4779a3c056 Mon Sep 17 00:00:00 2001 From: mtttz Date: Thu, 30 Mar 2023 06:29:48 +0200 Subject: [PATCH] Document support for escaped UTF-16 and UTF-32 Unicode characters Fixes #5607 --- tutorials/scripting/gdscript/gdscript_basics.rst | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tutorials/scripting/gdscript/gdscript_basics.rst b/tutorials/scripting/gdscript/gdscript_basics.rst index f942cbdd7..b12ba1880 100644 --- a/tutorials/scripting/gdscript/gdscript_basics.rst +++ b/tutorials/scripting/gdscript/gdscript_basics.rst @@ -487,9 +487,19 @@ Strings can contain the following escape sequences: +---------------------+---------------------------------+ | ``\\`` | Backslash | +---------------------+---------------------------------+ -| ``\uXXXX`` | Unicode codepoint ``XXXX`` | +| ``\uXXXX`` | UTF-16 Unicode codepoint | +| | ``XXXX`` | | | (hexadecimal, case-insensitive) | +---------------------+---------------------------------+ +| ``\UXXXXXX`` | UTF-32 Unicode codepoint | +| | ``XXXXXX`` | +| | (hexadecimal, case-insensitive) | ++---------------------+---------------------------------+ + +There are two ways to represent an escaped Unicode character above 0xFFFF: + +- as a `UTF-16 surrogate pair `_ ``\uXXXX\uXXXX``. +- as a single UTF-32 codepoint ``\UXXXXXX``. Also, using ``\`` followed by a newline inside a string will allow you to continue it in the next line, without inserting a newline character in the string itself.