mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Will Dietz <w@wdtz.org>
To: musl@lists.openwall.com
Subject: [PATCH] iconv: fix to=utf32 to behave like utf32be (not... ascii?)
Date: Thu, 3 May 2018 14:45:12 -0500	[thread overview]
Message-ID: <CAKGWAO_49MdiUvoDzMiKqjQEmhB8fF1VdH3FSB4qUcyZMBcW-g@mail.gmail.com> (raw)

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

Attached, I think it's just a case of a missing case statement.

This is needed or the result can't be read back as utf32 which seems
like an important property.

~Will

[-- Attachment #2: utf32.patch --]
[-- Type: text/x-patch, Size: 878 bytes --]

From f49ee6afa69d0736ddad1ace0adfb4597075a6ac Mon Sep 17 00:00:00 2001
From: Will Dietz <w@wdtz.org>
Date: Thu, 3 May 2018 13:44:53 -0500
Subject: [PATCH] iconv: fix conversion to utf32, treat like utf32be

I'm not sure how best to describe current behavior,
we treat to=utf32 somewhat like to=ascii
and the result is not valid UTF32.

This change treats to=utf32 like to=utf32be,
similar to what's done with utf16.
---
 src/locale/iconv.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/locale/iconv.c b/src/locale/iconv.c
index 3c1f4dd2..3a34395c 100644
--- a/src/locale/iconv.c
+++ b/src/locale/iconv.c
@@ -646,6 +646,8 @@ size_t iconv(iconv_t cd, char **restrict in, size_t *restrict inb, char **restri
 			*out += 4;
 			*outb -= 4;
 			break;
+		case UTF_32:
+			totype = UTF_32BE;
 		case UTF_32BE:
 		case UTF_32LE:
 			if (*outb < 4) goto toobig;
-- 
2.17.0


             reply	other threads:[~2018-05-03 19:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-03 19:45 Will Dietz [this message]
2018-05-07 18:06 ` Will Dietz
2018-05-07 19:25   ` Rich Felker
2018-05-07 20:52     ` Will Dietz

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=CAKGWAO_49MdiUvoDzMiKqjQEmhB8fF1VdH3FSB4qUcyZMBcW-g@mail.gmail.com \
    --to=w@wdtz.org \
    --cc=musl@lists.openwall.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.
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).