/[packages]/cauldron/groff/current/SOURCES/groff-1.20.1-nroff-convert-encoding.patch
ViewVC logotype

Contents of /cauldron/groff/current/SOURCES/groff-1.20.1-nroff-convert-encoding.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 259 - (show annotations) (download)
Fri Jan 7 16:09:30 2011 UTC (13 years, 3 months ago) by pterjan
File size: 1679 byte(s)
imported package groff
1 There are manpages written in many different encodings. This patch makes nroff
2 recognize its input encoding and then pass it to groff as the "-K" argument
3 (which will call preconv).
4
5 The patch also adds a "2>/dev/null" which is used to prevent error messages when
6 you open a big manpage and quickly close it.
7
8 diff -Nru groff-1.20.1/src/roff/nroff/nroff.sh i18n/src/roff/nroff/nroff.sh
9 --- groff-1.20.1/src/roff/nroff/nroff.sh 2009-01-09 12:25:52.000000000 -0200
10 +++ i18n/src/roff/nroff/nroff.sh 2009-11-19 10:35:14.000000000 -0200
11 @@ -125,6 +125,33 @@
12 T=-T$Tloc ;;
13 esac
14
15 +# copy the man page to a temp file
16 +TMPFILE=$(mktemp /tmp/man.XXXXXX)
17 +trap "rm -f $TMPFILE" 0 1 2 3 15
18 +cat ${1+"$@"} >| ${TMPFILE}
19 +
20 +# test the charset encoding of the man page
21 +if iconv -f utf-8 -t utf-8 -o /dev/null ${TMPFILE} 2>/dev/null
22 +then
23 + charset_in=utf-8
24 +else
25 + # non utf-8 encoding
26 + case "${LANGUAGE-${LC_CTYPE-${LANG}}}" in
27 + cs*|hr*|hu*|pl*|ro*|sk*|sl*) charset_in=iso-8859-2 ;;
28 + el*) charset_in=iso-8859-7 ;;
29 + tr*) charset_in=iso-8859-9 ;;
30 + bg*) charset_in=cp1251 ;;
31 + ja*) charset_in=euc-jp ;;
32 + ko*) charset_in=euc-kr ;;
33 + ru*) charset_in=koi8-r ;;
34 + uk*) charset_in=koi8-u ;;
35 + zh_TW*|zh_HK*) charset_in=big5 ;;
36 + zh_CN*|zh*) charset_in=gb2312 ;;
37 + *) charset_in=iso-8859-1 ;;
38 + esac
39 +fi
40 +
41 +
42 # Set up the `GROFF_BIN_PATH' variable
43 # to be exported in the current `GROFF_RUNTIME' environment.
44
45 @@ -133,6 +160,6 @@
46
47 # Load nroff-style character definitions too.
48
49 -PATH="$GROFF_RUNTIME$PATH" groff -mtty-char $T $opts ${1+"$@"}
50 +PATH="$GROFF_RUNTIME$PATH" cat $TMPFILE | groff -K $charset_in -mtty-char $T $opts 2>/dev/null
51
52 # eof

  ViewVC Help
Powered by ViewVC 1.1.30