This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/6530] *printf() and incomplete multibyte sequences returns -1 bogusly
- From: "avarab at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 30 Aug 2010 13:47:37 -0000
- Subject: [Bug libc/6530] *printf() and incomplete multibyte sequences returns -1 bogusly
- References: <20080518102318.6530.madcoder@debian.org>
- Reply-to: sourceware-bugzilla at sourceware dot org
------- 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 are on the CC list for the bug, or are watching someone who is.