Bug 47964

Summary: lpr can nor print Japanese plain text file
Product: [Retired] Red Hat Linux Reporter: Bill Huang <bhuang>
Component: printconfAssignee: Tim Waugh <twaugh>
Status: CLOSED RAWHIDE QA Contact: Brock Organ <borgan>
Severity: high Docs Contact:
Priority: high    
Version: 7.3CC: tagoh, ynakai
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-04-03 13:12:13 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Bill Huang 2001-07-09 08:18:07 UTC
Description of Problem:
lpr can't print Japanese plain text file.

How Reproducible:
Always

Steps to Reproduce:
1. lpr aaa(Japanese plain text)
2.
3.

Actual Results:
Japanese can not be displayed on the paper

Expected Results:
Japanese can be printed properly

Additional Information:

Comment 1 Glen Foster 2001-07-13 19:47:13 UTC
This defect considered MUST-FIX for Fairfax gold-release.

Comment 2 Crutcher Dunnavant 2001-08-02 21:51:03 UTC

*** This bug has been marked as a duplicate of 50144 ***

Comment 3 Akira TAGOH 2001-08-24 05:43:08 UTC
This problem is different #50144

Comment 4 Bill Nottingham 2001-08-28 14:37:00 UTC
Please explain how it is different, and what's wrong.

Comment 5 Nakai 2001-08-28 19:30:23 UTC
foomatic problem is to support Japanese printers in printconf or not.
This problem is just a command line handling problem between gs and lpr.

There should be some code conversion process with 'nkf' while sending
data to lpr, but it affects other language. This problem also occurs
on our RHL7.1.

Comment 6 Crutcher Dunnavant 2001-08-28 22:35:46 UTC
this is _finaly_ fixed.

Comment 7 Akira TAGOH 2001-09-07 11:18:35 UTC
I have tested it on re0907.4 but this problem still be NOT fixed.
I tried test print on printconf-gui.
but,

- Failed Japense JIS Text Testpage - the reason is mojibake.
- Failed Japanese EUC Text Testpage - same reason
- Failed echo "Japanese strings..." | lpr - the reason is empty page.

mf.cfg is here:
# foomatic/magicfilter configuration
# Make:         Canon
# Model:        LIPS-IVv
# Printer Id:   Canon-LIPS-IVv
# Driver:       lips4v
# TERMINATION=
# FILTER_LOCALE=C

define(MAKE, `Canon')dnl
define(MODEL, `LIPS-IVv')dnl
define(COLOR, `false')dnl
define(PAGEsize, `Letter')dnl
define(TEXTfilter, pipe/postscript/ /usr/bin/mpage -b ifdef(`PAGEsize',
PAGEsize, Letter) -1 -o -P- -)dnl
define(PSfilter, `filter /usr/share/printconf/util/mf_postscript_wrapper 
--mfomatic -d lips4v-Canon-LIPS-IVv.foo')dnl
define(PCLfilter, `cat')dnl
define(PJLfilter, `cat')dnl
define(DEFAULTfilter, `cat')dnl


Comment 8 Akira TAGOH 2001-09-07 13:53:48 UTC
test page is prints out successfully by changing the filter locale to ja_JP.
However we can know the current locale. why does't the filter locale guess from
locale?
Also, test of "echo ... | lpr" can be correctly printed by the following:
echo "Japanese strings..." | nkf -mj | lpr


Comment 9 Tim Waugh 2002-02-04 15:38:14 UTC
Oh, is this just that the locale _default_ is wrong?  If so, that's easy to fix
of course.  So that would fix the SJIS case properly, right?

To handle EUC-JP properly, we need a magicfilter that can recognise ISO-8859
text.  Investigating.

Comment 11 Tim Waugh 2002-02-04 18:31:46 UTC
I have committed a change to CVS to set the default effective filter locale to
'jp_JP' if the LANG environment variable begins with 'ja'.

Comment 12 Akira TAGOH 2002-02-05 03:17:32 UTC
That changing would be better.
However it's not fundamental solution. At least there are Japanese printers
which can't handle SJIS and EUC-JP encodings.
So that I suggest that it converts all of Japanese plain text to JIS encoding.


Comment 13 Tim Waugh 2002-02-05 09:55:08 UTC
Okay.. HOW?

Comment 14 Akira TAGOH 2002-02-05 10:27:16 UTC
Well, using define(DEFAULTfilter, pipe nkf -mj)dnl instead of is easiest, I
think. it works for me.

Comment 15 Tim Waugh 2002-02-05 10:35:25 UTC
This is the current code for setting DEFAULTfilter:

if ($control->{'flags'}{'assume_data_is_text'}) {
        $default_filter = $text_filter;
} else {
        $default_filter = qw?`cat'?;
}

Am I correct in thinking that the $text_filter bit works for Japanese?  I.e. if
you set assume_data_is_text to false, does printing work then?


Comment 16 Akira TAGOH 2002-02-05 10:59:59 UTC
Hmm, indeed. it works fine. it mean when sets 'ja_JP' to 'Effective Filter
Locale', this problem can be solved that 'Assume Unknown Data is Text' is forced
turn on, right?


Comment 17 Tim Waugh 2002-02-05 11:04:33 UTC
Yes, in fact just like with ko and zh:

        # Enable 'Rerender Postscript' and 'Assume Data is Text'
        # if LANG begins with 'zh' or 'ko'
        rerender = 0
        locale = 'C'
        if os.environ.has_key("LANG"):
                lang = os.environ["LANG"]
                if lang[0:2] == "zh" or lang[0:2] == "ko":
                        rerender = 1

                if lang[0:2] == "ja":
                        locale = 'ja_JP'

I'll change this so that rerender is set to 1 (which also sets 'assume data is
text' to default to true) in the case that lang[0:2]=='ko'.

Comment 18 Tim Waugh 2002-02-05 11:20:12 UTC
Hopefully this is fixed now in printconf-0.3.66-1 (currently building).  Note
that it only changes the defaults for a new queue; it doesn't change existing
queues.  Please test it out.

Thanks for your help.

Comment 19 Tim Waugh 2002-02-05 13:56:56 UTC
Oh, wait, I copied the fix for something else, but it seems that that fix didn't
work to start with.  Re-fixing.

Comment 20 Tim Waugh 2002-02-05 15:54:55 UTC
Okay, try 0.3.67-1.

Comment 21 Akira TAGOH 2002-02-06 13:00:44 UTC
it works fine. Thanks!!

Comment 22 Tim Waugh 2002-04-03 13:12:08 UTC
This seems to have broken again since 0.3.67 (see bug #62609).

Comment 23 Tim Waugh 2002-04-03 13:29:09 UTC
Oh, it's alright.  This bug was for 'assume unknown data is text', which still
works.