kern/114578: [libc] wide character printing using swprintf(dst, n, "%ls", txt) fails depending on LC_CTYPE

Garrett Wollman wollman at csail.mit.edu
Mon Sep 29 16:20:04 UTC 2008


The following reply was made to PR kern/114578; it has been noted by GNATS.

From: Garrett Wollman <wollman at csail.mit.edu>
To: Christoph Mallon <christoph.mallon at gmx.de>
Cc: freebsd-gnats-submit at freebsd.org
Subject: Re: kern/114578: [libc] wide character printing using swprintf(dst, 
 n, "%ls", txt) fails depending on LC_CTYPE
Date: Mon, 29 Sep 2008 11:44:27 -0400

 <<On Mon, 29 Sep 2008 08:10:03 GMT, Christoph Mallon <christoph.mallon at gmx.de> said:
 
 >> fputwc(3) has similar language about copying the character to the
 >> output stream, but POSIX still says it can fail with EILSEQ if the
 >> wide character doesn't exist in the current locale.
  
 >  fputwc() is entierly different from swprintf(): fputwc() writes to a 
 >  stream, swprintf() writes to an array of wchar_t.
  
 >> This isn't my area of expertise, but the present behavior seems
 >> correct.
  
 >  No, it isn't.
 
 The Standard is clear:
 
 	In addition, all forms of fwprintf() may fail if:
 
 	[EILSEQ]	A wide-character code that does not correspond
 			to a valid character has been detected.
 
 (IEEE Std.1003.1-2001 page 471, line 15515)
 
 You may wish that it was implemented differently, but that doesn't
 mean that the current implementation is wrong.
 
 -GAWollman
 


More information about the freebsd-standards mailing list