ND's
ND's

Reputation: 2215

Invalid token or compile time error for japanese/chinese characters in C#

public partial class Form1 : Form
    {
        public static string TestApp_ListItem_騾髏魄鮴鯰鰰鴃鶲_b4823038;

        public Form1()
        {
            InitializeComponent();


        }
    }

As in above code need to create object of type string using some japanese/chinese string characters used same in visual studio 2010 when i compile its giving me build errors like "Invalid token,Unexpected character".

How can i overcome this problem. Build error

Upvotes: 1

Views: 467

Answers (1)

aepot
aepot

Reputation: 4824

Possible useful answers in this question.

BTW, I cannot reproduce the errors in Visual Studio 2019 Community/Professional (Windows 10 x64 / Winforms App / .NET Framework 4.6) for neither Chinese nor Japanese. All compiles and works fine even if I targeting .NET Framework 2.0.

Tested with:

public static string TestApp_ListItem_騾髏魄鮴鯰鰰鴃鶲_b4823038;

public static string TestApp_ListItem_どうもありがとうございました_b4823038;

Consider to update the Visual Studio and SDK because old MSBuild/Compiler may contain incompartibilities with CJK characters due to old internal lexical structure in C# Language specification.

Upvotes: 3

Related Questions