Internationalization and localization tools


Culture-Sensitive VB.NET Constructor

using System.Text

Public Sub New

Public Sub New(bigEndian As Boolean, byteOrderMark As Boolean)

Public Sub New(bigEndian As Boolean, byteOrderMark As Boolean, throwOnInvalidBytes As Boolean)

Internationalization (I18n) Class Overview

The UnicodeEncoding class encodes Unicode characters in Unicode Transformation Format, 16-bit encoding form (UTF-16); that is, the character is encoded in a 16-bit field consisting of two consecutive bytes.

For more information see Microsoft's MSDN online documentation. Also, see specific MSDN documentation on Encoding Properties.

I18n Issues

Use of this class probably does not pose an I18n problem. Globalyzer detects it by default because during the internationalization process it is important that you are aware of all of the places in your code where you are performing character encoding conversions. Further, if UnicodeEncoding is being used to convert character data intended for use on a non-Windows platform, it is important that the endian value be properly passed to the constructor. Macintosh systems, for example, internally use UTF-16 Unicode, but big endian, which is the opposite of Windows.

The two bytes of an encoded character are stored in either little-endian or big-endian byte order depending on the computer architecture. In big-endian architectures the most significant byte is written and read first, while in little-endian architectures the least significant byte is written and read first.

This class provides a constructor that can specify whether an encoding is little-endian or big-endian, and also whether a byte order mark is used.

A UTF-16 encoding can be prefixed by a byte order mark (U+FEFF) to indicate the byte order used. It is assumed that the encoding is big-endian if the byte order mark is hexadecimal 0xFEFF, and little-endian if the byte order mark is hexadecimal 0xFFFE.

If endianness and byte order mark support are not specified to the constructor, the constructor requests little-endian byte ordering and byte order mark support

If, once you have examined a particular instantiation of the UnicodeEncoding class, you determine that it does not pose I18n problems, you can use Globalyzer's Ignore Comment functionality to ensure that it isn't picked up in a subsequent scan.

VB.NET Encoding Information

 

Lingoport internationalization and localization services and software