bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

pr considers bytes not presentation width


From: Dan Jacobson
Subject: pr considers bytes not presentation width
Date: Mon, 25 Dec 2006 23:58:42 +0800

Double width characters don't line up with pr or pr|expand.
LC_ALL doesn't change things. Perhaps it is counting Unicode as bytes,
perhaps it is thinking every character is one column wide.

$ set 001 台中-谷關 東勢-興中山莊-台中
$ pr -mT $@|head -n 6
*{{b|仁友東站}}                     *{{b|台中火車站}}                    *{{b|東勢站}}
*{{b|第一廣場}}                     *{{b|台中公園}}                     *{{b|老人會館}}
*{{b|自由路口(公園路)}}                *{{b|台中技術學院}}                   *{{b|東新國中}}
*{{b|立體停車場}}                    *{{b|中友百貨}}                     *{{b|新豐街}}
*{{b|合作金庫}}                     *{{b|一心市場}}                     *{{b|土牛}}
*{{b|市政府}}                      *{{b|新民中學}}                     *{{b|南眉}}

$ pr -mT $@|expand|head -n 6
*{{b|仁友東站}}                     *{{b|台中火車站}}                  *{{b|東勢站}}
*{{b|第一廣場}}                     *{{b|台中公園}}                     *{{b|老人會館}}
*{{b|自由路口(公園路)}}          *{{b|台中技術學院}}                       *{{b|東新國中}}
*{{b|立體停車場}}                  *{{b|中友百貨}}                     *{{b|新豐街}}
*{{b|合作金庫}}                     *{{b|一心市場}}                     *{{b|土牛}}
*{{b|市政府}}                        *{{b|新民中學}}                     *{{b|南眉}}

$ for i do iconv -t big5 $i>$i.b; done #2 bytes per Chinese character. Above 
was UTF-8: 3 bytes
$ pr -mT *.b|expand|head -n 6|iconv -f big5
*{{b|仁友東站}}         *{{b|台中火車站}}               *{{b|東勢站}}
*{{b|第一廣場}}         *{{b|台中公園}}         *{{b|老人會館}}
*{{b|自由路口(公園路)}}         *{{b|台中技術學院}}             *{{b|東新國中}}
*{{b|立體停車場}}                       *{{b|中友百貨}}         *{{b|新豐街}}
*{{b|合作金庫}}         *{{b|一心市場}}         *{{b|土牛}}
*{{b|市政府}}           *{{b|新民中學}}         *{{b|南眉}}

We see the problem is that it is considering bytes, not presentation
width, which should be one (ASCII) or two...




reply via email to

[Prev in Thread] Current Thread [Next in Thread]