I wish. But '1#\xC2\x0A' converts correctly, as the newline isn't seen…

This commit is contained in:
tg 2008-04-20 00:45:49 +00:00
parent 073890bc57
commit 7573a15ae0
1 changed files with 16 additions and 6 deletions

22
check.t
View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.182 2008/04/20 00:28:30 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.183 2008/04/20 00:45:49 tg Exp $
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
@ -4812,6 +4812,10 @@ stdin:
print -n "\u${i#16#1}"
done
print
print \\xff # invalid utf-8
print \\xc2 # invalid 2-byte
print \\xef\\xbf\\x80 # invalid 3-byte
print \\xc2\\x80 # non-minimalistic
} | {
typeset -Uui16 -Z11 pos=0
typeset -Uui16 -Z5 hv
@ -4822,17 +4826,23 @@ stdin:
while IFS= read -r line; do
line=$line$nl
while [[ -n $line ]]; do
if (integer x=1#${line::3}) 2>&-; then
n=3
elif (integer x=1#${line::2}) 2>&-; then
(( hv = 1#${line::1} & 0xFF ))
if (( (hv < 0xC2) || (hv >= 0xF0) )); then
n=1
elif (( hv < 0xE0 )); then
n=2
else
n=1
n=3
fi
(( n == 1 )) || eval integer 'x=1#${line::n}' 2>/dev/null || print -u2 on 1#${line::n}
(( n == 1 )) || \
(integer x=1#${line::n}) 2>/dev/null || n=1
wc=1#${line::n}
if (( (wc < 32) || \
((wc > 126) && (wc < 160)) )); then
dch=.
elif (( (wc & 0xFF80) == 0xEF80 )); then
dch=<EFBFBD>
else
dch=${wc#1#}
fi
@ -4890,5 +4900,5 @@ expected-stdout:
00000170 A7 C3 A8 C3 A9 C3 AA C3 - AB C3 AC C3 AD C3 AE C3 |èéêëìíîï|
00000180 AF C3 B0 C3 B1 C3 B2 C3 - B3 C3 B4 C3 B5 C3 B6 C3 |ðñòóôõö÷|
00000190 B7 C3 B8 C3 B9 C3 BA C3 - BB C3 BC C3 BD C3 BE C3 |øùúûüýþÿ|
000001A0 BF 0A - |.|
000001A0 BF 0A FF 0A C2 0A EF BF - 80 0A C2 80 0A |.<EFBFBD>.<EFBFBD>.<EFBFBD><EFBFBD>.<EFBFBD><EFBFBD>.|
---