Keil™, An ARM® Company

Technical Support

ARMCC: ARE WIDE CHARACTER (UNICODE) STRINGS SUPPORTED


Information in this article applies to:

  • RealView C Compiler Version 3

QUESTION

Does MDK-ARM support unicode characters?

When I build the following test program:

void wide_ch_test(void)    {
  wchar_t str1[] = L"Size of message is: ";
  wchar_t str2[80];

  swprintf(str2,sizeof(str2)/sizeof(wchar_t),L"%s",str1);
  gputsw(str2);
}

The line with swprintf function call fails with the warning:

warning:  #181-D: argument is incompatible with
                  corresponding format string conversion

ANSWER

Wide characters are fully supported. However, you must use the correct format string. Instead of #%s", use #%ls". In your example, change the swprintf function call line to:

swprintf (str2, (sizeof(str2)/sizeof(wchar_t)), L"%ls", str1);

Last Reviewed: Thursday, August 17, 2006


Did this article provide the answer you needed?
 
Yes
No
Not Sure