ceylon/ceylon-spec — Issue #179: Unicode escapes in string/character literals
Author: gavinking
Created: 2012-02-18 14:00:58+00:00
State: open
Labels: feature, request for feedback

We've decided not to support unicode escapes in source code, but only inside literals. I have a couple of questions about the syntax for this.

The traditional syntax is `\uXXXX`, but there are a couple of problems with that:

1. you need to have a different escape `\UXXXXXXXX` to cover the full Unicode character set, and
2. the character code tends to run into the rest of the text in string literals - `"\u00E5ngstr\u00F6ms"` is not very readable.

We could improve this by changing the syntax slightly, the most natural options seem to be `\u{XXXX}` or `\uXXXX;`, for example:

"\u{00E5}ngstr\u{00F6}ms"

or:

"\u00E5;ngstr\u00F6;ms"

OTOH, it does make me question whether we even need special syntax at all. Is the above really much better than something like this:

"" uc('00E5') "ngstr" uc('00F6') "ms"

Finally, Python supports named escapes using the syntax `\N{LATIN SMALL LETTER A}`. I think we should support this.