dotnet/roslyn

Roslyn rejects \U unicode characters in identifiers

Open

#13,560 opened on Sep 2, 2016

View on GitHub
 (0 comments) (0 reactions) (1 assignee)C# (4,257 forks)batch import
Area-CompilersBugLanguage-C#Tenet-Localizationhelp wanted

Repository metrics

Stars
 (20,414 stars)
PR merge metrics
 (Avg merge 6d 17h) (256 merged PRs in 30d)

Description

Roslyn rejects Unicode characters in the range U+10000 to U+10FFFF in identifiers. This is specifically called out as supported in the language specification, but does not work in the compilers. See https://msdn.microsoft.com/en-us/library/aa664669(v=vs.71).aspx . Here is a sample:

using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    public static void Main(string[] args)
    {
        int \U00020000 = 10; http://www.fileformat.info/info/unicode/char/20000/index.htm
        Console.WriteLine(\U00020000);
    }
}

See also #13474 and #9731, which report related errors when surrogate pairs (rather than Unicode escape sequences) appear in the input.

Contributor guide