Unconsistent iconv appendixes //TRANSLIT and //IGNORE

Bug #1796868 reported by Miguel Sacristan Izcue
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
glibc (Ubuntu)
New
Undecided
Unassigned

Bug Description

The appendixes of //TRANSLIT and //IGNORE can not work together on the same call.
It appears that it only works the first one to appear.

Example Code:
#########################################
#include <iconv.h>
#include <iostream>
#include <memory>
#include <cstring>
#include <string>
#include <utf8.h>

int main()
{
        const std::string in = "\xc5\xbd";
        iconv_t cd = iconv_open("ISO8859-1//TRANSLIT//IGNORE", "UTF-8");
        const char* inbuffer = in.c_str();
        char outbuffer[in.length()*2+1];
        memset(outbuffer, 0, in.length()*2+1);
        size_t srclen = in.length();
        size_t targetlen = in.length()*2+1;
        char* wrptr = outbuffer;
        iconv(cd,const_cast<char **>(&inbuffer), &srclen, &wrptr, &targetlen);
        iconv_close(cd);

        std::cout << outbuffer << std::endl;
}
########################################

With "//TRANSLIT" first:
 - "?"
WITH "//IGNORE" first:
 - ""

I am expecting to work together so that if there is a translit for that character it translates it and if there is non it just ignores it instead of writing a "?".

This is at least the behaviour i get when compiling in other platforms (FreeBSD)

An while we are it we could add a translit for this specific case so that "\xc5\xbd" => "Z" ?

Thanks in Advance

- lsb_release -rd:
UBUNTU 18.04.01 LTS
- Package version:
libglib2.0-dev:
  Installed: 2.56.2-0ubuntu0.18.04.2

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.