Bug 165368

Summary: iconv doesn't completely clean up converter state when converting from UTF-16
Product: [Fedora] Fedora Reporter: Matthias Clasen <mclasen>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: drepper
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-08-08 17:51:51 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
a testcase none

Description Matthias Clasen 2005-08-08 16:44:28 UTC
It does not forget a seen BOM, therefore, you cannot reuse a UTF-16 -> UTF-8
converter for converting chunks of UTF-16 of different endianness, even if they
both start with a BOM.

The attached testcase demonstrates this.

Comment 1 Matthias Clasen 2005-08-08 16:44:28 UTC
Created attachment 117544 [details]
a testcase

Comment 2 Ulrich Drepper 2005-08-08 17:51:51 UTC
This is not a bug.  Flushing using iconv() only resets the shift state.  This is
needed for stateful encodings with states where the caller wants a converted
string to end in the initial state.  The BOM recognition has nothing to do with
shift states.  Once the byte order is determined this is a property which stays
with the iconv_t descriptor for its lifetime.