Internationalization and localization tools


ANSI Custom Print Formatting Functions

 

Internationalization (I18n) Issue:

These functions are used to create custom printf-like formatting functions. They do not provide "native" support for wide characters and wide character strings, so some changes need to be made if your custom format specifiers need to handle wide character strings.

Additionally, if migrating to a UTF-16 or UTF-32 application, you will need to change any printf family of functions being used in your custom handler to their wide counterparts.

I18n Solution:

If migrating to a UTF-16 or UTF-32 application from a single byte or UTF-8 multibyte application, you will have to make the following changes.

First, if you are using printf functions such as sprintf in your registered print handler, you will need to change them to the wide versions, such as swprintf. Note that you also may need to change format specifiers in your swprintf formats as is typical for migrating to a wide character code base. For example, you may need to use %ls instead of %s when formatting strings since they are now wide character strings.

Second, if you are using PA_CHAR or PA_STRING you will note that there are no wide character counterparts. You will have to either create your own data types, or use the types PA_INT and PA_POINTER respectively and then cast the data to the appropriate type in your handler.

For more details and examples see the Customizing Printf section of the GNU Libc manual.

Click on a function for more information:

printf_size

printf_size_info

register_printf_function

 

 Locale-Sensitive C++ Methods

 

Lingoport internationalization and localization services and software