Internationalization and localization tools


Culture-Sensitive C# Attribute

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]

The following lists the named, optional parameters for StructLayout:
   CharSet
   Pack
   Size

Internationalization (I18n) Method Overview

The StructLayout attribute allows control over the physical layout of a class or structure's data fields. As a minimum requirement, you must supply the LayoutKind (set to either Auto, Explicit or Sequential). You apply this attribute to classes or structures.

For more information see Microsoft's MSDN online documentation.

I18n Issues

The default for the CharSet parameter is ANSI, which causes character corruption if Unicode text not matching the current system code page is passed to the StructLayout class. While having unmapped characters could pose a security risk, the bigger issue from an internationalization perspective is that Unicode will not be supported unless CharSet is explicitly specified.

Instead of this:
   [StructLayout(LayoutKind.Sequential)]

Should specify CharSet:
   [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]

C# Encoding Information

 

Lingoport internationalization and localization services and software