1

I want to print a file using a command like cat filename > /dev/lp0 where the file contains characters like ùàç encoded in UTF-8. Is this is possible or do I need to use CUPS?

I'm using an embedded Linux with a Debian file system and 3.10 kernel version.

The printer is an Epson SX525WD connected with USB, but the system and CUPS detected this like a parallel printer /dev/lp0. The CUPS version installed is 1.5.3, and when I try to print the file with lp command it returns:

lp: Unsupported document-format "text/plain"

So I have to use -oraw to print and it doesn't print UTF-8 characters.

Gilles 'SO- stop being evil'
864k204 gold badges1.8k silver badges2.3k bronze badges
asked Sep 12, 2014 at 8:44
0

3 Answers 3

1

Yes that is possible. You can directly cat a file to a printer like that and go around using CUPS.

Whether the result is what you expect depends on the content of the file and the make and model of the printer.

answered Sep 14, 2014 at 4:16
0

Here is a small shell script I use since more than 20 years for old printers who don't manage UTF-8 ( source pr8.sh, installed as /opt/bin/pr8 ) :

#!/bin/sh
case 1ドル in
-r) opts="1ドル"
 shift
 ;;
esac
cat "$@" |
 iconv --unicode-subst="_" -f utf-8 -t iso-8859-1 |
 enscript ${opts:+${opts}}

For more recent printers it's much easier, just use lpr:

lpr my_file.txt
answered Aug 16, 2024 at 15:32
-2

Use enca,and find
Install enca

$apt-get install enca

execute below command

$ enca filename
answered Sep 12, 2014 at 9:40
2
  • Thank you for the reply, when I execute "enca filename" returns: enca: Language `it' is unknown or not supported. Commented Sep 12, 2014 at 12:02
  • 2
    enca can detect a file's encoding, but that isn't the problem here. The problem is to convert UTF-8 text to the unspecified format expected by the printer. Commented Sep 13, 2014 at 23:10

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.