Le 26/11/15 19:13, Yuri Pankov a écrit : > On Thu, 26 Nov 2015 18:53:04 +0100, Richard PALO wrote: >> I filed https://www.illumos.org/issues/6480#change-15783 >> >> Just curious if anybody else has noticed this sort of thing, perhaps in >> other tools than /usr/bin/tr? > > I think that our tr is correct here - \254 is illegal sequence for > character in UTF-8 encoding (and tr is "translate characters" as defined > in tr(1) man page), probably GNU tr simply doesn't check? > > Also, are you sure the GNU tr works correctly for you (all done with > en_US.UTF-8 locale): > > altair:yuri:~$ echo 'a b' | /usr/bin/tr ' ' $'\254' > tr: illegal sequence > altair:yuri:~$ echo 'a b' | /usr/bin/tr ' ' $'\302\254' > a¬b > altair:yuri:~$ echo 'a b' | /usr/gnu/bin/tr ' ' $'\254' > a▒b > altair:yuri:~$ echo 'a b' | /usr/gnu/bin/tr ' ' $'\302\254' > a > altair:yuri:~$ >
Hmm, I'm still undecided. FWIW I don't have the last issue with gtr, > richard@omnis:/home/richard/src/ttr$ /usr/gnu/bin/tr --version |head -1 > tr (GNU coreutils) 8.24 (nor with 8.23) In the script, it is an extended ascii character ('¬' or '\254') that is provided. Granted this isn't printable in all locales, but that is not its usage here, it becomes a delimiter for subsequent uses of 'cut'. I can't seem to find any particular clause in POSIX that says the form `tr string1 string2` must use 'printable' characters. The source in coreutils only seems to ensure that each octal byte in quoted form is .le. 255. That is, used simply as a byte, as illustrated with the /usr/gnu/bin/tr example which works, 'cut' even seems to do its job consequently. Can you point me to the relevant clause in POSIX justfying the 'illegal sequence' in illumos tr? -- Richard PALO ------------------------------------------- illumos-discuss Archives: https://www.listbox.com/member/archive/182180/=now RSS Feed: https://www.listbox.com/member/archive/rss/182180/21175430-2e6923be Modify Your Subscription: https://www.listbox.com/member/?member_id=21175430&id_secret=21175430-6a77cda4 Powered by Listbox: http://www.listbox.com