This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug stdio/6530] *printf() and incomplete multibyte sequences returns -1 bogusly
- From: "jrnieder at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: Sat, 23 Jun 2012 20:34:55 +0000
- Subject: [Bug stdio/6530] *printf() and incomplete multibyte sequences returns -1 bogusly
- Auto-submitted: auto-generated
- References: <bug-6530-131@http.sourceware.org/bugzilla/>
http://sourceware.org/bugzilla/show_bug.cgi?id=6530
--- Comment #21 from Jonathan Nieder <jrnieder at gmail dot com> 2012-06-23 20:34:55 UTC ---
Created attachment 6474
--> http://sourceware.org/bugzilla/attachment.cgi?id=6474
test conversion from UTF-8 and handling of incomplete characters (fails)
I assume Joseph means to spend some time to avoid future authors breaking
wprintf now that our attention's on it, not to avoid breaking wprintf when
applying your patch. Your patch doesn't even touch wprintf code.
I tried writing a wprintf testcase, and it's not gone so well. For
example, I tried
wchar_t buf[1000];
int n;
if (!setlocale(LC_ALL, "ja_JP.UTF-8)) {
perror("setlocale");
return 1;
}
n = swprintf(buf, sizeof(buf)/sizeof(wchar_t), L"%3s",
"\xef\xbd\xa1g\xef\xbd\xa2h\xef\xbd\xa3i\xef\xbd\xa4j");
I expected swprintf to return 3 and buf to equal
{ 0xff61, 'g', 0xff62, 0 }
Instead, swprintf returns 8 and converts the entire string.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.