I’ve received a text file in which the text is like this, ãYAHOO.COM. When I’m debugging in Visual Studio, the value I see for the character is “�”c. Firstly can anyone tell what is the character before yahoo. Is it a special character or some html character, and what is the character that I’m seeing in VS while debugging.
So it goes like this, the ascii value of the character turns out to be 63.But when I write the value to a file it generates 3 characters whose ascii values are above 127. Very Weird
How can this be handled in VB.NET
You must specify the correct encoding when you read the file (the same as was used to write the file). For example, if you read the file using a StreamReader, you might have code like:
The second parameter represents the encoding. Here we use the default encoding (ANSI). If you’ve got some unknown or strange characters using this encoding, you can try using a different encoding like
System.Text.Encoding.Utf8orSystem.Text.Encoding.Ascii.