mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] [BUG] swprintf() doesn't handle Unicode characters correctly
@ 2021-05-24  4:39 Konstantin Isakov
  2021-05-24 21:50 ` Rich Felker
  0 siblings, 1 reply; 7+ messages in thread
From: Konstantin Isakov @ 2021-05-24  4:39 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 674 bytes --]

Hi,

The following program:

===================================
#include <stdio.h>
#include <wchar.h>

int main()
{
  wchar_t buf[ 32 ];

  swprintf( buf, sizeof( buf ) / sizeof( *buf ), L"ab\u00E1c" );

  for ( wchar_t * p = buf; *p; ++p )
    printf( "%u\n", ( unsigned ) *p );

  return 0;
}
===================================

With musl 1.2.2 produces the following output:
97
98

The expected output is:
97
98
225
99

With musl, only the first two characters ('a' and 'b') are processed, and
the string ends on a Unicode character (U+00E1, which is an 'a' with acute
accent), instead of outputting it and the last character, 'c'.

Please CC me when replying. Thanks!

[-- Attachment #2: Type: text/html, Size: 1035 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-05-25  1:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-24  4:39 [musl] [BUG] swprintf() doesn't handle Unicode characters correctly Konstantin Isakov
2021-05-24 21:50 ` Rich Felker
2021-05-25  0:04   ` Konstantin Isakov
2021-05-25  0:30     ` Rich Felker
2021-05-25  0:46       ` Konstantin Isakov
2021-05-25  1:09         ` Rich Felker
2021-05-25  1:58           ` Konstantin Isakov

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).