[Bug 1796868] [NEW] Unconsistent iconv appendixes //TRANSLIT and //IGNORE

Miguel Sacristan Izcue 1796868 at bugs.launchpad.net
Tue Oct 9 11:49:02 UTC 2018


Public bug reported:

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

** Affects: glibc (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to glibc in Ubuntu.
https://bugs.launchpad.net/bugs/1796868

Title:
  Unconsistent iconv appendixes //TRANSLIT and //IGNORE

Status in glibc package in Ubuntu:
  New

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 manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1796868/+subscriptions



More information about the foundations-bugs mailing list