summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclEncoding.c4
-rw-r--r--tests/chanio.test18
-rw-r--r--tests/io.test10
3 files changed, 19 insertions, 13 deletions
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c
index 9bce621..cfc8caa 100644
--- a/generic/tclEncoding.c
+++ b/generic/tclEncoding.c
@@ -2304,7 +2304,7 @@ UtfToUtfProc(
*/
if (flags & TCL_ENCODING_MODIFIED) {
- if (!(flags & TCL_ENCODING_NOCOMPLAIN)) {
+ if (!(flags & TCL_ENCODING_NOCOMPLAIN) && (flags & TCL_ENCODING_CHAR_LIMIT)) {
result = TCL_CONVERT_MULTIBYTE;
break;
}
@@ -3085,7 +3085,7 @@ TableFromUtfProc(
word = fromUnicode[(ch >> 8)][ch & 0xFF];
if ((word == 0) && (ch != 0)) {
- if (!(flags & TCL_ENCODING_NOCOMPLAIN)) {
+ if (!(flags & TCL_ENCODING_NOCOMPLAIN) && (flags & TCL_ENCODING_CHAR_LIMIT)) {
result = TCL_CONVERT_UNKNOWN;
break;
}
diff --git a/tests/chanio.test b/tests/chanio.test
index cbb94a6..8d922a2 100644
--- a/tests/chanio.test
+++ b/tests/chanio.test
@@ -255,9 +255,11 @@ test chan-io-3.4 {WriteChars: loop over stage buffer} -body {
chan configure $f -encoding jis0208 -buffersize 16
chan puts -nonewline $f "\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"
set x [list [contents $path(test1)]]
-} -cleanup {
chan close $f
-} -errorCode {POSIX EILSEQ {illegal byte sequence}} -match glob -result {error writing "*": illegal byte sequence}
+ lappend x [contents $path(test1)]
+} -cleanup {
+ catch {chan close $f}
+} -result [list "!)!)!)!)!)!)!)!)" "!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)"]
test chan-io-3.5 {WriteChars: saved != 0} -body {
# Bytes produced by UtfToExternal from end of last channel buffer had to
# be moved to beginning of next channel buffer to preserve requested
@@ -266,9 +268,11 @@ test chan-io-3.5 {WriteChars: saved != 0} -body {
chan configure $f -encoding jis0208 -buffersize 17
chan puts -nonewline $f "\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"
set x [list [contents $path(test1)]]
-} -cleanup {
chan close $f
-} -errorCode {POSIX EILSEQ {illegal byte sequence}} -match glob -result {error writing "*": illegal byte sequence}
+ lappend x [contents $path(test1)]
+} -cleanup {
+ catch {chan close $f}
+} -result [list "!)!)!)!)!)!)!)!)!" "!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)"]
test chan-io-3.6 {WriteChars: (stageRead + dstWrote == 0)} -body {
# One incomplete UTF-8 character at end of staging buffer. Backup in src
# to the beginning of that UTF-8 character and try again.
@@ -297,9 +301,11 @@ test chan-io-3.7 {WriteChars: (bufPtr->nextAdded > bufPtr->length)} -body {
chan configure $f -encoding jis0208 -buffersize 17
chan puts -nonewline $f "\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"
set x [list [contents $path(test1)]]
-} -cleanup {
chan close $f
-} -errorCode {POSIX EILSEQ {illegal byte sequence}} -match glob -result {error writing "*": illegal byte sequence}
+ lappend x [contents $path(test1)]
+} -cleanup {
+ catch {chan close $f}
+} -result [list "!)!)!)!)!)!)!)!)!" "!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)"]
test chan-io-3.8 {WriteChars: reset sawLF after each buffer} -body {
set f [open $path(test1) w]
chan configure $f -encoding ascii -buffering line -translation lf \
diff --git a/tests/io.test b/tests/io.test
index 83381c8..f07fa8d 100644
--- a/tests/io.test
+++ b/tests/io.test
@@ -279,7 +279,7 @@ test io-3.4 {WriteChars: loop over stage buffer} -body {
lappend x [contents $path(test1)]
} -cleanup {
catch {close $f}
-} -errorCode {POSIX EILSEQ {illegal byte sequence}} -match glob -result {error writing "*": illegal byte sequence}
+} -result [list "!)!)!)!)!)!)!)!)" "!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)"]
test io-3.5 {WriteChars: saved != 0} -body {
# Bytes produced by UtfToExternal from end of last channel buffer
# had to be moved to beginning of next channel buffer to preserve
@@ -293,7 +293,7 @@ test io-3.5 {WriteChars: saved != 0} -body {
lappend x [contents $path(test1)]
} -cleanup {
catch {close $f}
-} -errorCode {POSIX EILSEQ {illegal byte sequence}} -match glob -result {error writing "*": illegal byte sequence}
+} -result [list "!)!)!)!)!)!)!)!)!" "!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)"]
test io-3.6 {WriteChars: (stageRead + dstWrote == 0)} {
# One incomplete UTF-8 character at end of staging buffer. Backup
# in src to the beginning of that UTF-8 character and try again.
@@ -326,7 +326,7 @@ test io-3.7 {WriteChars: (bufPtr->nextAdded > bufPtr->length)} -body {
lappend x [contents $path(test1)]
} -cleanup {
catch {close $f}
-} -errorCode {POSIX EILSEQ {illegal byte sequence}} -match glob -result {error writing "*": illegal byte sequence}
+} -result [list "!)!)!)!)!)!)!)!)!" "!)!)!)!)!)!)!)!)!)!)!)!)!)!)!)"]
test io-3.8 {WriteChars: reset sawLF after each buffer} {
set f [open $path(test1) w]
fconfigure $f -encoding ascii -buffering line -translation lf \
@@ -1538,7 +1538,7 @@ test io-12.8 {ReadChars: multibyte chars split} {
close $f
scan [string index $in end] %c
} 160
-test io-12.9 {ReadChars: multibyte chars split} -constraints knownBug -body {
+test io-12.9 {ReadChars: multibyte chars split} -body {
set f [open $path(test1) w]
fconfigure $f -translation binary
puts -nonewline $f [string repeat a 9]\xC2
@@ -1551,7 +1551,7 @@ test io-12.9 {ReadChars: multibyte chars split} -constraints knownBug -body {
} -cleanup {
catch {close $f}
} -result 194
-test io-12.10 {ReadChars: multibyte chars split} -constraints knownBug -body {
+test io-12.10 {ReadChars: multibyte chars split} -body {
set f [open $path(test1) w]
fconfigure $f -translation binary
puts -nonewline $f [string repeat a 9]\xC2