Unicode Character Problems

Source: Internet
Author: User

Knowledge points:

1. Windows 98 only supports ANSI and can only develop applications for ANSI.

2. windows and later support both Unicode and ANSI, so you can develop applications for any type. However, you must understand that the kernel only processes Unicode. When the system processes ANSI, you need to first convert to Unicode and then pass it to the operating system. After the operating system completes processing, the system then converts Unicode to an ANSI string and returns it to the application.

3. Windows CE only supports Unicode and can only develop applications for Unicode.

4. COM component: All COM interface methods that require strings can only accept Unicode characters.

5. the macro (UNICODE) is used to control whether the system calls the wide character version or the narrow character version when calling the operating system API. The (_ Unicode) is used to control the use of tchar. h. The ANSI/Unicode common source code file is an application that uses the character set. (_ Unicode) is used for the C Runtime header file, while (UNICODE) is used for the Windows header file.

6. Windows functions generally have two versions. Assume that there is an API: createmediawex, the Unicode function is createmediawexw, And the ANSI function is createmediawexa.

7. Windows provides a wide range of string operation functions. It is recommended, which will slightly help improve the performance of the application. The shlwapi. h header file must be added to these functions.

8. Use (lcid getthreadlocale () to obtain the current language settings of the thread.

9. Some C runtime functions do not provide good support for Unicode. In this case, you need to use the string functions provided by windows, such as charlower and charupper functions for case-insensitive conversion.

10. When the resource compiler compiles all resources, the output file is the binary file of the resource. The string value in the resource is always a unicode string.

11. Use istextunicode to determine whether a piece of text is Unicode or ANSI. Note that this function uses a series of statistical and qualitative methods to guess the cached content. Therefore, this method may return incorrect results.

12. Use multibytetowidechar and widechartomultibyte to perform Equivalent Conversion between wide strings and multi-byte strings.

One thing I think: People who are engaged in applications may seldom realize their character set problems, especially. NET development, because. all characters in. NET are Unicode characters (default), but during interoperability, you may need to specify the character set type for sending and processing. In addition, kernel-driven developers may get along with a unicode_string structure that represents a unicode string. We use limited kernel functions to deal with this structure.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.