Is there a way to make runtime library routines such as wcstod and printf treat wchar_t data as UCS-2?
The -W c,'convlit(,UNICODE)' compiler option causes wide literal strings to use the UCS-2 encoding, but seems to have no effect on runtime library routines.
BTW I'm compiling with c89 in the z/OS shell. I can not switch my program to using ASCII. It must be an EBCDIC program.
This topic has been locked.
2 replies Latest Post - 2011-01-12T15:15:53Z by dinoxlc
Pinned topic Is there a way to make runtime library routines treat wchar_t data as UCS-2
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2011-01-12T15:15:53Z at 2011-01-12T15:15:53Z by dinoxlc
SystemAdmin 110000D4XK196 PostsACCEPTED ANSWER
Re: Is there a way to make runtime library routines treat wchar_t data as UCS-22011-01-11T23:47:57Z in response to SystemAdminIf I have an array of wide characters containing UCS2 data, is there a way to get printf to respect it is UCS2 and print it correctly?
dinoxlc 120000AD0A1 PostACCEPTED ANSWER
Re: Is there a way to make runtime library routines treat wchar_t data as UCS-22011-01-12T15:15:53Z in response to SystemAdminRun time library functions that deal with wide character data require a proper locale that supports the encoding of wide characters. If the active locale does not support UCS2 encoding there is no way for such run time library functions, including printf, to properly process UCS2 data.
Typically the active locale matches the environment in which an application is running. If a display or a printer is based on EBCDIC encoding, the application that uses a UCS2 based locale will not work unless automatic conversion is active and the output is directed to a file (e.g. stdout) which is tagged. Even then, the information produced by the application must contain characters that are supported by EBCDIC devices or it will not be shown properly.
If it is known that the wide character data is UCS2 based, the application can convert it using iconv run time library function before it tries to display it to an EBCDIC device (assuming that the characters contained in the UCS2 based data are supported by EBCDIC devices).