OpenPrinting / cups-filters

filters, backends, driverless utility, ... - Everything which CUPS 2.x needs to be used on non-Mac systems
Apache License 2.0
151 stars 122 forks source link

cups-filter: erroneous localization in .ppd files #503

Open kanyck opened 1 year ago

kanyck commented 1 year ago

I don't know how relevant this bug report is provided that cups-filters-2 is under way, just to make sure this bug will not be inherited into the new branch.

PPD standard states that all the .ppd lines must be in English in ISOLatin1 encoding and all localization is done via ru.something es.something... or *nl.Translation types of lines as in

*MediaType PLAIN_HIGH/Plain paper: "<</HWResolution[360 360]>>setpagedevice"
*nl.MediaType PLAIN_NORMAL/Gewoon papier: ""
*ru.MediaType PLAIN_NORMAL/Простая бумага: ""
etc.

However cups-filter-1.28.17 generates mixed languages lines for non-English locale, i.e. *MediaType PLAIN_HIGH/Простая бумага: "<</HWResolution[360 360]>>setpagedevice" which causes cryptic menu items in printer dialog. I had to edit the file by hand checking it with cupstestppd Also, some non-printable characters were also included, like back-double-quote to represent inches, that are non-printable within ISOLatin1.

To Reproduce

  1. Generate PPD file via lpadmin -p Epson -E -v ipps://EPSON0B79A1.local:631/ipp/print -m driverless:ipps://EPSON0B79A1.local:631/ipp/print
  2. Check the generated file with cupstestppd
  3. See erroneous ouput.

Expected behavior Standard conformance while generating .ppd files.

sourabh1952 commented 1 year ago

@kanyck can you please provide the /var/log/cups/error_log file in .txt format so that I will try to find what is the root cause of this erroneous ppd files. First set CUPS to debug logging before generating ppd file (cupsctl --debug-logging).

tillkamppeter commented 1 year ago

Note that there are two approaches to internationalize PPDs:

  1. Adobe's original approach: A PPD file can only support a single language, to support more than one language several single-language PPDs, one per supported language, for the same printer model are supplied. In the beginning of the PPD file you find somewhere an entry for which language the PPD is. The human-readable strings (after the slash) for option and choice names are in that one language.
  2. CUPS extension for multi-language PPDs: One single PPD can support any amount of languages. Primarily these PPDs pretend to be English PPDs, telling that they are for English language and using English human-readable strings in the option definitions, but they also contain a list of languages they support plus extra translation lines for each additiona language, like shown above:
    *MediaType PLAIN_NORMAL/Plain paper: "<</HWResolution[360 360]>>setpagedevice"
    *nl.MediaType PLAIN_NORMAL/Gewoon papier: ""
    *ru.MediaType PLAIN_NORMAL/Простая бумага: ""
    etc.

    So a print dialog which supports the extension will display the options in the correct UI language of the user if the PPD has translations for the language, otherwise in English. If the print dialog only supports the original Adobe approach, it shows all options and choices in English.

Paarth353 commented 1 year ago

@tillkamppeter So do we need to install this CUPS extension in order to fix the issue?

tillkamppeter commented 1 year ago

There is no "CUPS extension" which one can install. CUPS extends the PPD standard, by using additional attributes, whose keywords start with *cups.... This allows for extra functionality compared to Adobe's original standard for PostScript printers, most famous example are the *cupsFilter: ... lines to define a driver filter and so allow to use PPD files with non-PostScript printers. This is already built into CUPS (and also cups-filters), no extenstions need to get installed for that.

See https://openprinting.github.io/cups/doc/spec-ppd.html

There is also the extension for multi-language PPD files descibed.