Share via


General MBCS Programming Advice

Unicode TasksMultibyte Character Set (MBCS) Tasks

Use the following tips:

  • For flexibility, use run-time macros such as _tcschr and _tcscpy when possible. For more information, see Generic-Text Mappings in TCHAR.H.

  • Use the C run-time _getmbcp function to get information about the current code page.

  • Do not reuse string resources. Depending on the target language, a given string may have a different meaning when translated. For example, “File” on the application’s main menu might translate differently from the string “File” in a dialog box. If you need to use more than one string with the same name, use different string IDs for each.

  • You may want to find out whether or not your application is running on an MBCS-enabled operating system. To do so, set a flag at program startup; do not rely on API calls.

  • When designing dialog boxes, allow approximately 30% extra space at the end of static text controls, to allow for MBCS translation.

  • Be careful when selecting fonts for your application, because some fonts are not available on all systems. For example, the Japanese version of Windows NT does not support the Helvetica font.

  • When designing your application, decide which strings can or cannot be localized. If in doubt, assume that any given string will be localized. As such, do not mix strings that can be localized with those that cannot.

See Also   Incrementing and Decrementing Pointers