[Bug libc/6530] *printf() and incomplete multibyte sequences returns -1 bogusly
------- Additional Comments From avarab at gmail dot com 2010-08-30 13:47 -------
Here's a simpler testcase for this bug courtesy of Jonathan Nieder:
#include <stdio.h>
#include <locale.h>
int main(void)
{
int n;
setlocale(LC_CTYPE, "");
n = printf("%.11s\n", "Author: \277");
perror("printf");
fprintf(stderr, "return value: %d\n", n);
return 0;
}
Under a C locale that'll do the right thing:
$ LANG=C ./test
Author: �
printf: Success
return value: 10
But not under a UTF-8 locale, since \277 isn't a valid UTF-8 sequence:
$ LANG=en_US.utf8 ./test
printf: Invalid or incomplete multibyte or wide character
return value: -1
--
http://sourceware.org/bugzilla/show_bug.cgi?id=6530
------- You are receiving this mail because: -------
You reported the bug, or are watching the reporter.
You are on the CC list for the bug, or are watching someone who is.
Reply to: