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.
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 Posts
Re: Is there a way to make runtime library routines treat wchar_t data as UCS-22011-01-11T23:47:57ZThis is the accepted answer. This is the accepted answer.If 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 120000AD0A3 Posts
Re: Is there a way to make runtime library routines treat wchar_t data as UCS-22011-01-12T15:15:53ZThis is the accepted answer. This is the accepted answer.
- SystemAdmin 110000D4XK
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).