[cups.bugs] [MOD] STR #1983: Current locale is not honored in all cases

Andreas F. Borchert cups at andreas-borchert.de
Thu Sep 21 05:09:08 PDT 2006


[STR New]

Since 1.2 cups works internally with a UTF-8 encoding. Commands like lp and
lpr should honor the current locale to decide which encoding is used for
the input files.

The code for this decision resides in cups/language.c in the function
cupsLangGet which, among other parameters, attempts to find out the
current encoding. Configurations that rely on the usage of
nl_langinfo(CODESET) fail unfortunately. Take a look at following
if-statement at line 453 ff.:

#ifdef CODESET
 /*
  * On systems that support the nl_langinfo(CODESET) call, use
  * this value as the character set...
  */ 
 
  if (!charset[0] && (csptr = nl_langinfo(CODESET)) != NULL)
  {
   /*
    * Copy all of the letters and numbers in the CODESET string...
    */

The problem is that at this point charset[0] will never be 0
as charset was already set to "UTF8" as default in line 415.

This bug can be solved by postponing the fall-back to "UTF8"
after having checked nl_langinfo(CODESET). Attached you'll find
a working patch which was tested for the latest stable release 1.2.3.
It should also work for the most current release.

Link: http://www.cups.org/str.php?L1983
Version: 1.3-current
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: language.c.PATCH
URL: <https://lists.cups.org/pipermail/cups/attachments/20060921/4720f25a/attachment.ksh>


More information about the cups mailing list