Pseudo-CCSID Neutrality
When a program is compiled with UTF support, the runtime allows
more than just UTF-8 characters, and it essentially becomes CCSID
neutral. The runtime handles whatever CCSID is contained within
the current locale. By default, when a program is compiled with UTF
support, the locale that is loaded is a UTF-8 (CCSID 1208) locale.
This allows the runtime to handle CCSID 1208. If the
setlocale() function
is called to set the locale to an EBCDIC locale (for example, a CCSID
37 locale), the runtime handles CCSID 37. This, along with the #pragma
convert support within the compiler, can be used to provide
international application support. Here is an example:
#include <stdio.h>
#include <locale.h>
int main() {
/* This string is in CCSID 1208 */
printf("Hello World\n");
/* Change locale to a CCSID 37 locale */
setlocale(LC_ALL, "/QSYS.LIB/EN_US.LOCALE");
#pragma convert(37)
/* This string is in CCSID 37 */
printf("Hello World\n");
return 0;
}