buglibiconv - Bugs: bug #57723, Conversion from CP1258 to UTF-8...

 
 

bug #57723: Conversion from CP1258 to UTF-8 may drop last byte

Submitter:  None
Submitted:  Sun 02 Feb 2020 09:18:28 AM UTC
   
 
Category:  Converters Severity:  3 - Normal
Item Group:  None Status:  Not a Bug
Privacy:  Public Assigned to:  haible
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 02 Feb 2020 11:34:27 AM UTC, comment #1: 

Your code is lacking an iconv(cd, NULL, NULL, &outbufp, &outleft) call at the end. Look at



  • the example code in libiconv/extras/iconv_string.c for a working example.
Bruno Haible <haible>
Group administrator
Sun 02 Feb 2020 09:18:28 AM UTC, original submission:  

When converting CP1258 encoded texts to UTF-8, the last character may be dropped, without any error indication.  This appears to happen regardless of the length of the input text.  Conversion from CP1252 works as expected.

The attached program iconv-bug.c shows that; the last assertion fails.

Apparently, the last character is considered to be a combining character, so cp1258_mbtowc() returns RET_TOOFEW(1), but unicode_loop_convert() then returns without calling cp1258_mbtowc() again.

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #48331:  iconv-bug.c added by None (551B - text/plain)

 

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)
  •  

    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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-02-02 haible StatusNone Not a Bug
        Assigned toNone haible
        Open/ClosedOpen Closed
    2020-02-02 None Attached File- Added iconv-bug.c, #48331

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code