Bug 215754

Summary: enscript is locale sensitive
Product: [openSUSE] openSUSE 10.2 Reporter: Björn Voigt <bjoernv>
Component: OtherAssignee: Dr. Werner Fink <werner>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Major    
Priority: P5 - None CC: mohr
Version: Beta 1   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: Other Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: enscript test case for German and English and UTF-8

Description Björn Voigt 2006-10-27 15:41:50 UTC
The enscript program does not work right in all locales. Especially it does not work right in the default UTF-8 locale settings.

The problem only occurs together with the "-E" switch of enscript.

"-E" is a parameter with an optional argument. It is documented as follows (from man page):

       -E[lang], --highlight[=lang]
               Highlight source code by creating a special input  filter  with
               the  states  program.  The optional argument lang specifies the
               language to highlight.  As a default the states makes  an  edu-
               cated guess.

               You can print a short description of the supported highlighting
               languages and file formats with the command:

               enscript --help-highlight

               The    highlighting    rules     are     defined     in     the
               `/usr/share/enscript/st/*.st' files which can be edited to cre-
               ate highlighting definitions for new languages.

               Note! You can not use your own input filters with this  option.

A test case is attached.
Comment 1 Björn Voigt 2006-10-27 15:45:46 UTC
Created attachment 102853 [details]
enscript test case for German and English and UTF-8
Comment 2 Björn Voigt 2006-11-01 09:55:57 UTC
Which info do you need?
Comment 3 Dr. Werner Fink 2006-11-02 10:26:07 UTC
What I need is a enscript vers9ion which is able to handle UTF-8. The current
version of enscript uses a wrapper script to be able to convert _one_
language provided in UTF-8 into the appropiate latin code because this is
the only code which is usable with the enscript program its self.

If you have a patch which makes enscript fully compatible with UTF-8 please
reopen this bug.  But be aware UTF-8 is highly complicated in comparision
to any 8 bit character mode like latin-1.
Comment 4 Björn Voigt 2006-11-02 11:19:33 UTC
Sorry, this is not what I mean. I know that enscript is not capable of printing UTF-8. The wrapper script therefore tries to convert UTF-8 data to ISO-8859-X. This is ok for me.

The problem is, that the wrapper script does not work correctly. Enscript needs the option -E in a special form. So "-Ebash" is correct, but "-E bash" is not. Of course this violates the getopt() standard functionality. But the wrapper script uses getopt for changing the enscript arguments.

I already found the problem in the wrapper script. 

I start "enscript" with a clean environment in trace mode:

$ env -i HOME=$HOME LANG=de_DE.UTF-8 PATH=$PATH sh -x enscript -Ebash -o /dev/null  /etc/skel/.bashrc
[...]
+ CMDLINE=' -E '\''bash'\'' -o '\''/dev/null'\'' -- '\''/etc/skel/.bashrc'\'''
[...]
+ enscript.bin -X ISO-8859-15 -E bash -o /dev/null /etc/skel/.bashrc

So the problem is that we started with "-Ebash" and ended with "-E bash".
Comment 5 Dr. Werner Fink 2006-11-13 14:27:48 UTC
Just fixed not only for -E but also for -C, -e, -H, amd -u.
Comment 6 Dr. Werner Fink 2007-02-06 18:23:23 UTC
*** Bug 242022 has been marked as a duplicate of this bug. ***