0

I could not able to check the invalid semicolon in the code. I unsure how the client is posting the invalid character, due to that the system getting error. I have the invalid semicolon,(;) but I could not able to recreate the invalid semi-column in the editor(code). When trying to paste the invalid semicolon into the editor, it is converting automatically to normal keyboard value(;). So the scope of the invalid semicolon getting ignored in the code The invalid semicolon is only visible in some of the textboxes like gmail,gira

I have tried with following

public string ReplaceInvalidIso8859Characters(string str)
        {
            var replacements = new Dictionary<string, string>
            {
                {";", ";"}

            };

            var newBodyBuilder = new StringBuilder(str);
            replacements.ForEach(_ => newBodyBuilder.Replace(_.Key, _.Value));
            return newBodyBuilder.ToString();
        }

enter image description here

enter image description here

Damien_The_Unbeliever
  • 234,701
  • 27
  • 340
  • 448
  • [Why images are not good while posting a question](https://meta.stackoverflow.com/questions/285551/why-not-upload-images-of-code-on-so-when-asking-a-question) – Prashant Pimpale Sep 17 '19 at 06:22
  • https://stackoverflow.com/questions/1922199/c-sharp-convert-string-from-utf-8-to-iso-8859-1-latin1-h Does this help? – Esc Điệp Sep 17 '19 at 06:36
  • Why is that semicolon considered invalid? What do you use the semicolons for? – Lasse V. Karlsen Sep 17 '19 at 07:08
  • Unicode never disappoints. Possible candidates are U+037E (likely to appear in Greek text, question mark) and U+FF1B (likely to appear in Japanese text). Let the debugger tell you which one it is, inspect str.ToCharArray() and switch to hexadecimal. – Hans Passant Sep 17 '19 at 07:13

1 Answers1

1

you can use character codes for this, you can convert any incompatible characters in the editor to semicolun ("U + 003B") in c #
char c1 = '\ u003B';
You can catch the way. For other character codes Have a look at http://www.fileformat.info/info/unicode/char/003b/encoding.htm