ASP.NET How to deal with “unexpected character” when writing code

Compiler error message: CS1056: Handling of unexpected characters

error generated:

An “unexpected character” error occurred in C# code while compiling an ASP. NET 4.0 website using VS2010.

does not use UTF-8 format for display and save, the compiler can not correctly recognize such characters, resulting in compilation error.

:

set the file open mode of VS 2010, make it in view of the error file using utf-8 format to open. The specific operation is as follows:

1) In Solution Explorer, select the file you want to open

2) Right mouse button pops up the menu, select “Open mode”, and use “Charp editor with encoding function” to open it. As shown in the figure below:

Instead, select the following in the code:

then rebuild the solution, error elimination.

Read More: