[Bug locale/34377] New: iconv_open() ignores unrecognized indicator suffices

michael at orlitzky dot com via Glibc-bugs <[email protected]> Wed, 08 Jul 2026 14:01:34 +0000
Newsgroups gmane.comp.lib.glibc.bugs
Message-ID <[email protected]/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=34377

            Bug ID: 34377
           Summary: iconv_open() ignores unrecognized indicator suffices
           Product: glibc
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: locale
          Assignee: unassigned at sourceware dot org
          Reporter: michael at orlitzky dot com
  Target Milestone: ---

iconv_open() allows certain indicator suffices (//IGNORE, for example) to be
appended to the destination codeset. The glibc implementation will accept any
suffix, such as //INVALID, but will ignore the ones it does not recognize.

According to POSIX, the codeset names (and thus any suffices appended to them)
are implementation-defined, so accepting something like ASCII//INVALID is
technically OK. But a problem arises when iconv_open() accepts and ignores a
suffix whose behavior is defined by the spec. At this time, only
//NON_IDENTICAL_DISCARD fits that description.

Glibc's iconv_open() will accept //NON_IDENTICAL_DISCARD as a suffix, but does
not implement the behavior that is required of it:

  * https://pubs.opengroup.org/onlinepubs/9799919799/functions/iconv_open.html
  * https://pubs.opengroup.org/onlinepubs/9799919799/functions/iconv.html

iconv_open() can fail with EINVAL to indicate that a suffix is unrecognized or
not supported, so it would be better to reject any that are unrecognized. At
the very least, it should reject //NON_IDENTICAL_DISCARD explicitly as
unsupported, leaving all others to do an implementation-defined nothing.

-- 
You are receiving this mail because:
You are on the CC list for the bug.