Line Suppression State Error CS1056 Unexpected character '​'

SyntaxEditor for WPF Forum

Posted 3 years ago by Abdulmalik Seyfi
Version: 20.1.1
Platform: .NET 5.0
Environment: Windows 10 (64-bit)
Avatar

I'm doing this code to save files from syntaxEditor

but I'm getting the error Unexpected character '​' when compiling

       public void saveascommand()
        {
            Microsoft.Win32.SaveFileDialog dlgs = new Microsoft.Win32.SaveFileDialog();
            dlgs.FileName = "Document"; // Default file name
            dlgs.DefaultExt = ".text"; // Default file extension
            dlgs.Filter = "C# (.cs)|*.cs|VB.NET (.vb)|*.vb|HTML (.html)|*.html|JavaScript (.js)|*.js|XML (.xml)|*.xml|XAML (.xaml)|*.xaml|SQL (.sql)|*.sql"; // Filter files by extension
            Nullable<bool> result = dlgs.ShowDialog();
            if (result == true)
            {
                File.WriteAllText(dlgs.FileName, string.Empty);
                using (StreamWriter sw = File.AppendText(dlgs.FileName))
                {
                    ​syntaxEditor.Document.SaveFile(dlgs.FileName, LineTerminator.CarriageReturnNewline);
                    filename = System.IO.Path.GetFileName(dlgs.FileName);
                    filepath = dlgs.FileName;
                    savedfirsttime = true;
                    Title = "ProCode | " + filename;
                }
            }


        }

Comments (1)

Posted 3 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

When I pasted your code above into a C# file here and tried saving it, VS told me that there was a Unicode character not supported by the current code page.  Somewhere in there, you have a special Unicode character, maybe an unprintable one.  You could either narrown down which line(s) have it or try retyping the text from scratch to eliminate it.


Actipro Software Support

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.