X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Wed, 26 Jan 2011 17:15:56 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: Bug in libiconv? Message-ID: <20110126161556.GP28470@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <1309 DOT 192 DOT 168 DOT 6 DOT 58 DOT 1296044105 DOT squirrel AT simlinux> <20110126132613 DOT GN28470 AT calimero DOT vinschen DOT de> <4D402507 DOT 6030205 AT cwilson DOT fastmail DOT fm> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <4D402507.6030205@cwilson.fastmail.fm> User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On Jan 26 08:43, Charles Wilson wrote: > On 1/26/2011 8:26 AM, Corinna Vinschen wrote: > > On Jan 26 13:15, simrw AT sim-basis DOT de wrote: > >>> Here's what happens on Cygwin: > >>> - Even though the last parameter to iconv is defined in bytes, the > >>> value of outbytesleft after the conversion is the number of remaining > >>> wchar"t's, not the number of remaining bytes. That's contrary to > >>> what POSIX defines, see > >>> http://pubs.opengroup.org/onlinepubs/9699919799/functions/iconv.html > >> > >> IMHO, the count is correct. > >> On Windows/Cygwin, wchar_t is 2 bytes, on Linux, 4 bytes. > >> So the buffer is 512 bytes. > >> In the first 3 cases, 10 input bytes were consumed so that there remains > >> in the buffer (512 - 20) = 492 bytes. > >> In the last case all 16 bytes are consumed so there remains in > >> the buffer (512 - 32) = 480 bytes. > > > > Yes, you're right. Quite obviously I misinterpreted the results without > > realizing that the buffer is smaller under Cygwin. > > Sure, but there ARE still bugs in libiconv on Cygwin -- specifically: > - Even though iconv_open has been opened explicitely with "UTF-8" as > input string, the conversion still depends on the current application > codeset. That doesn't make sense. > and > - 'iconv_close ((iconv_t) -1);' crashes the application with a SEGV. Indeed. But it was an important hint, nevertheless. It just didn't occur to me that the buffer size is different between Cygwin and Linux. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple