buglibiconv - Bugs: bug #39238, Fixing bad utf8.

 
 

bug #39238: Fixing bad utf8.

Submitter:  None
Submitted:  Wed 12 Jun 2013 11:04:32 AM UTC
   
 
Category:  Converters Severity:  3 - Normal
Item Group:  None Status:  Fix Released
Privacy:  Public Assigned to:  haible
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 18 Nov 2016 08:47:41 AM UTC, comment #3: 

Sorry, I must have been confused since which implementation is used varies across Linux distributions. Good to see some activity here!

Milan Bouchet-Valat <nalimilan>
Thu 17 Nov 2016 11:14:05 PM UTC, comment #2: 

There are two iconv implementations in GNU: The one in GNU libc and the one in GNU libiconv. They operate in similar ways, but they are a different codebase.

As can be seen from your command 'iconv --from=UTF-8 --to=UTF-8 -c' (long options), you must be using the GNU libc one.

For GNU libc, the behaviour you reported is equivalent to https://sourceware.org/bugzilla/show_bug.cgi?id=2373

For GNU libiconv, the behaviour you reported has now been corrected: http://git.savannah.gnu.org/gitweb/?p=libiconv.git;a=commit;h=0a04404c90d6a725b8b6bbcd65e10c5fcf5993e9

Thank you for the report.

Bruno Haible <haible>
Group administrator
Tue 10 Sep 2013 10:02:09 AM UTC, comment #1: 

I am experiencing a similar issue: the invalid sequence \U3e3965 is not correctly removed. This is a problem since PCRE does not accept this character and generates an error.

# Correctly removed
$ echo -e "\xff" | iconv --from=UTF-8 --to=UTF-8 -c

# Not removed as it should
$ echo -e "\xf8\x8f\xa3\xa5\xa5" | iconv --from=UTF-8 --to=UTF-8 -c
���

Milan Bouchet-Valat <nalimilan>
Wed 12 Jun 2013 11:04:32 AM UTC, original submission:  

Hi,

I'm trying to clean utf8 encoded buffer using iconv and remove all invalid utf8 code points(below is my code snippet)

iconv_t conv = iconv_open("UTF-8//IGNORE","UTF-8");
iconvctl(conv, ICONV_SET_DISCARD_ILSEQ, &flag);
iconv(conv, &inbuf, &len, &outbuf, &outlen);
iconv_close(conv);

I noticed that it is not able to remove code points in range of 0xD800-0xDfff (surrogate pairs) even though these are not valid utf8 code points.

Other invalid code points like beyond 0x10FFFF and wrong/broken utf8 byte sequence is are cleaned successfully.

What might be the issue here?

Thanks,
Anurag

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by haible (Posted a comment)
  • -email is unavailable- added by nalimilan (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-01-04 haible StatusFixed Fix Released
    2016-11-23 haible CategoryNone Converters
    2016-11-17 haible StatusNone Fixed
        Assigned toNone haible
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code