public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jrnieder at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sources.redhat.com
Subject: [Bug stdio/6530] *printf() and incomplete multibyte sequences returns -1 bogusly
Date: Sat, 23 Jun 2012 20:35:00 -0000	[thread overview]
Message-ID: <bug-6530-131-6EJT2xcUE4@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <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.


  parent reply	other threads:[~2012-06-23 20:35 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-6530-131@http.sourceware.org/bugzilla/>
2012-02-21  1:33 ` jsm28 at gcc dot gnu.org
2012-03-11  6:26 ` ppluzhnikov at google dot com
2012-03-11 16:32 ` bugdal at aerifal dot cx
2012-03-11 16:57 ` carlos at systemhalted dot org
2012-03-11 17:00 ` carlos at systemhalted dot org
2012-03-11 17:04 ` bugdal at aerifal dot cx
2012-03-11 17:09 ` carlos at systemhalted dot org
2012-03-18 20:31 ` jrnieder at gmail dot com
2012-05-14 13:22 ` bugdal at aerifal dot cx
2012-06-22 21:03 ` carlos_odonell at mentor dot com
2012-06-22 21:23 ` jrnieder at gmail dot com
2012-06-22 22:08 ` carlos_odonell at mentor dot com
2012-06-22 22:21 ` bugdal at aerifal dot cx
2012-06-23  0:54 ` bugdal at aerifal dot cx
2012-06-23  2:31 ` jrnieder at gmail dot com
2012-06-23  3:04 ` bugdal at aerifal dot cx
2012-06-23  3:20 ` jrnieder at gmail dot com
2012-06-23  3:30 ` bugdal at aerifal dot cx
2012-06-23  4:22 ` jrnieder at gmail dot com
2012-06-23 11:01 ` joseph at codesourcery dot com
2012-06-23 11:38 ` bugdal at aerifal dot cx
2012-06-23 20:35 ` jrnieder at gmail dot com [this message]
2012-06-23 20:53 ` bugdal at aerifal dot cx
2012-06-23 21:01 ` jrnieder at gmail dot com
2012-06-24 15:03 ` joseph at codesourcery dot com
2012-06-24 21:45 ` bugdal at aerifal dot cx
2012-06-24 22:03 ` carlos_odonell at mentor dot com
2012-06-25  1:02 ` jrnieder at gmail dot com
2012-10-01 23:42 ` jrnieder at gmail dot com
2012-10-02 21:20 ` carlos_odonell at mentor dot com
2012-10-03  0:51 ` jrnieder at gmail dot com
2012-10-03  0:54 ` carlos_odonell at mentor dot com
2012-10-03 21:20 ` joseph at codesourcery dot com
2012-10-04  1:48 ` jrnieder at gmail dot com
2012-10-04  1:50 ` jrnieder at gmail dot com
2013-12-07 19:41 ` schwab@linux-m68k.org
2014-01-30 18:22 ` cvs-commit at gcc dot gnu.org
2014-02-16 19:42 ` jackie.rosen at hushmail dot com
2014-05-28 19:41 ` schwab at sourceware dot org
2014-06-13 11:29 ` fweimer at redhat dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-6530-131-6EJT2xcUE4@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).