Unicode Normalization in Windows

后端 未结 2 1329
醉梦人生
醉梦人生 2021-02-12 09:23

I\'ve been using \"unicode strings\" in Windows for as long as... I\'ve learned about Unicode (e.g. after graduating). However, it always mystified me that the Win32AP

2条回答
  •  执笔经年
    2021-02-12 09:54

    From the MSDN article Using Unicode Normalization to Represent Strings.

    Windows, Microsoft applications, and the .NET Framework generally generate characters in form C using normal input methods. For most purposes on Windows, form C is the preferred form. For example, characters in form C are produced by Windows keyboard input. However, characters imported from the Web and other platforms can introduce other normalization forms into the data stream.

    Update: I've included some specific details relating to Question #2.

    In regards to the file system, normalization is not required - based on the article Naming Files, Paths, and Namespaces.

    There is no need to perform any Unicode normalization on path and file name strings for use by the Windows file I/O API functions because the file system treats path and file names as an opaque sequence of WCHARs. Any normalization that your application requires should be performed with this in mind, external of any calls to related Windows file I/O API functions.

    In regards to SQL Server, no normalization is required - nor is data normalized when saved in the database. That said, when comparing strings, SQL Server 2000 uses its own string normalization mechanism inside of indexes; but I cannot find specific details on what that is. A SQL Server 2005 article states the same.

    One important change in SQL Server 7.0 was the provision of an operating system–independent model for string comparison, so that the collations between all operating systems from Windows 95 through Windows 2000 would be consistent. This string comparison code was based on the same code that Windows 2000 uses for its own string normalization, and is encapsulated to be the same on all computers and in all versions of SQL Server.

提交回复
热议问题