Skip to content
This repository was archived by the owner on Mar 10, 2026. It is now read-only.
This repository was archived by the owner on Mar 10, 2026. It is now read-only.

Current locale is not honored in all cases #1983

Closed

Description

@michaelrsweet

Version: 1.3-current
CUPS.org User: AFBorchert

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.

Activity

  1. michaelrsweet commented on Sep 21, 2006

    @michaelrsweet
    ContributorAuthor

    CUPS.org User: mike

    Fixed in Subversion repository.

  2. added this to the Stable milestone on Mar 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions