Vb.net character set

According to MSDN, vb.net uses this extended character set . In my experience, he really uses this:

alt text

  • What am I missing? Why does he say that he uses one and uses the other?
  • Am I doing something wrong?
  • Is there any tool to convert to the original character set?
+4
source share
3 answers

This behavior is defined in the Chr command documentation:

The return value depends on the codepage of the current stream, which is contained in the ANSICodePage property of the TextInfo class in the System.Globalization namespace. You can get ANSICodePage by specifying System.Globalization.CultureInfo.CurrentCulture.TextInfo.ANSICodePage.

Thus, the output of Chr for values ​​greater than 127 depends on the system. If you want reproducible results, create the desired Encoding instance by calling Encoding.GetEncoding (String) , then use Encoding.GetChars (Byte ()) to convert your numeric values ​​to characters.

If you go up one level in the diagram related to your question, you will see that they do not claim that this diagram is always the output of the Chr command:

The characters displayed in Windows above 127 depend on the font selected.

The charts in this section show the default character set for the console application.

Your application is a WinForm application, not a console application. Even in the console, the character set used can be changed (for example, using the chcp ), so the word "default".

For more information about the encodings used in .net, I recommend the following MSDN article: Character Encoding in the .NET Framework .

+6
source

The first character set is the code Page 437 (CP437), the second is the code Page 1252 (CP1252), also known as Windows Latin-1.

I would suggest that VB.Net just picks the default encoding for the PC.

+2
source

How do you write all this? Since usually, when you use the function of the output stream, you can specify the encoding that goes with it.

Edit: I know this is not C #, but you can see this idea ...

You will need to set the encoding of your stream by doing something like this: Setting the encoding when creating the stream

+1
source

All Articles