Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

About the "Character set" option in Visual Studio

I have an inquiry about the "Character set" option in Visual Studio. The Character Set options are:

  • Not Set
  • Use Unicode Character Set
  • Use Multi-Byte Character Set

I want to know what the difference between three options in Character Set?

Also if I choose something of them, will affect the support for languages ​​other than English (like RTL languages)?

like image 257
Lion King Avatar asked Feb 19 '12 12:02

Lion King


People also ask

What is the use of character set?

A "character set" is a mapping of characters to their identifying code values. The character set most commonly used in computers today is Unicode, a global standard for character encoding. Internally, Windows applications use the UTF-16 implementation of Unicode.

What is character set in Visual Basic?

Visual Basic provides character data types to deal with printable and displayable characters. While they both deal with Unicode characters, Char holds a single character whereas String contains an indefinite number of characters.

What does character set mean?

Every word is made up of symbols or characters. When you press a key on a keyboard, a number is generated that represents the symbol for that key. This is called a character code. A complete collection of characters is a character set.

What is character set give example?

A defined list of characters recognized by the computer hardware and software. Each character is represented by a number. The ASCII character set, for example, uses the numbers 0 through 127 to represent all English characters as well as special control characters.

How do I specify the source character set for an executable?

Lets you specify the source character set for your executable. The IANA-defined character set name. The code page identifier as a decimal number. You can use the /source-charset option to specify an extended source character set to use when your source files include characters that are not represented in the basic source character set.

How do I set a character set on a code page?

You can use either the IANA or ISO character set name, or a dot (.) followed by a 3 to 5 digit decimal code page identifier to specify the character set to use. For a list of supported code page identifiers and character set names, see Code Page Identifiers.

How do you convert internal character set to execution character set?

The internal representation is then converted to the execution character set to store string and character values in the executable. You can use either the IANA or ISO character set name, or a dot (.) followed by a 3 to 5 digit decimal code page identifier to specify the character set to use.

Where can I find the settings Editor in Visual Studio Code?

See more in Key Bindings for Visual Studio Code. By default VS Code shows the Settings editor, you can find settings listed below in a search bar, but you can still edit the underlying settings.json file by using the Open Settings (JSON) command or by changing your default settings editor with the workbench.settings.editor setting.


1 Answers

It is a compatibility setting, intended for legacy code that was written for old versions of Windows that were not Unicode enabled. Versions in the Windows 9x family, Windows ME was the last and widely ignored one. With "Not Set" or "Use Multi-Byte Character Set" selected, all Windows API functions that take a string as an argument are redefined to a little compatibility helper function that translates char* strings to wchar_t* strings, the API's native string type.

Such code critically depends on the default system code page setting. The code page maps 8-bit characters to Unicode which selects the font glyph. Your program will only produce correct text when the machine that runs your code has the correct code page. Characters whose value >= 128 will get rendered wrong if the code page doesn't match.

Always select "Use Unicode Character Set" for modern code. Especially when you want to support languages with a right-to-left layout and you don't have an Arabic or Hebrew code page selected on your dev machine. Use std::wstring or wchar_t[] in your code. Getting actual RTL layout requires turning on the WS_EX_RTLREADING style flag in the CreateWindowEx() call.

like image 81
Hans Passant Avatar answered Sep 22 '22 05:09

Hans Passant