When a program is compiled with UTF support, the run time allows more than just UTF-8 characters, and it essentially becomes CCSID neutral. The run time 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 run time to handle CCSID 1208. If the setlocale() routine is called to set the locale to an EBCDIC locale (for example, a CCSID 37 locale), the run time 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;
}