diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-05-06 14:16:58 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-05-06 14:16:58 (GMT) |
commit | 82b2bfa1b8f90760f53b543c9dc7e4fa7c2e3510 (patch) | |
tree | 36358aa43226fd7fd641c52c55fe0a4ee696297e | |
parent | 9e781ffb02d3f384c1123ddcb6f96944cc4dc3ef (diff) | |
download | tcl-82b2bfa1b8f90760f53b543c9dc7e4fa7c2e3510.zip tcl-82b2bfa1b8f90760f53b543c9dc7e4fa7c2e3510.tar.gz tcl-82b2bfa1b8f90760f53b543c9dc7e4fa7c2e3510.tar.bz2 |
Remove character/byte value from error-message, only use hex here.
-rw-r--r-- | generic/tclCmdAH.c | 4 | ||||
-rw-r--r-- | tests/encoding.test | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index 682ba3f..1361f11 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.c @@ -603,7 +603,7 @@ EncodingConvertfromObjCmd( char buf[TCL_INTEGER_SPACE]; sprintf(buf, "%" TCL_Z_MODIFIER "u", result); Tcl_SetObjResult(interp, Tcl_ObjPrintf("unexpected byte at index %" - TCL_Z_MODIFIER "u: '%c' (\\x%X)", result, UCHAR(bytesPtr[result]), UCHAR(bytesPtr[result]))); + TCL_Z_MODIFIER "u: '\\x%X'", result, UCHAR(bytesPtr[result]))); Tcl_SetErrorCode(interp, "TCL", "ENCODING", "STOPONERROR", buf, NULL); Tcl_DStringFree(&ds); @@ -704,7 +704,7 @@ EncodingConverttoObjCmd( TclUtfToUCS4(&stringPtr[result], &ucs4); sprintf(buf, "%" TCL_Z_MODIFIER "u", result); Tcl_SetObjResult(interp, Tcl_ObjPrintf("unexpected character at index %" - TCL_Z_MODIFIER "u: '%c' (U+%06X)", pos, ucs4, ucs4)); + TCL_Z_MODIFIER "u: 'U+%06X'", pos, ucs4)); Tcl_SetErrorCode(interp, "TCL", "ENCODING", "STOPONERROR", buf, NULL); Tcl_DStringFree(&ds); diff --git a/tests/encoding.test b/tests/encoding.test index 91fb1ec..355c2ec 100644 --- a/tests/encoding.test +++ b/tests/encoding.test @@ -605,16 +605,16 @@ test encoding-24.12 {Parse valid or invalid utf-8} { } 1 test encoding-24.13 {Parse valid or invalid utf-8} -body { encoding convertfrom -stoponerror utf-8 "\xC0\x81" -} -returnCodes 1 -result {unexpected byte at index 0: 'À' (\xC0)} +} -returnCodes 1 -result {unexpected byte at index 0: '\xC0'} test encoding-24.14 {Parse valid or invalid utf-8} -body { encoding convertfrom -stoponerror utf-8 "\xC1\xBF" -} -returnCodes 1 -result {unexpected byte at index 0: 'Á' (\xC1)} +} -returnCodes 1 -result {unexpected byte at index 0: '\xC1'} test encoding-24.15 {Parse valid or invalid utf-8} { string length [encoding convertfrom -stoponerror utf-8 "\xC2\x80"] } 1 test encoding-24.16 {Parse valid or invalid utf-8} -body { encoding convertfrom -stoponerror utf-8 "Z\xE0\x80" -} -returnCodes 1 -result {unexpected byte at index 1: 'à' (\xE0)} +} -returnCodes 1 -result {unexpected byte at index 1: '\xE0'} test encoding-24.17 {Parse valid or invalid utf-8} -constraints testbytestring -body { encoding convertto -stoponerror utf-8 [testbytestring "Z\u4343\x80"] } -returnCodes 1 -result {expected byte sequence but character 1 was '䍃' (U+004343)} @@ -626,7 +626,7 @@ test encoding-24.19 {Parse valid or invalid utf-8} -constraints testbytestring - } -result "Z\xC3\xA0\xE2\x82\xACxxxxxx" test encoding-24.20 {Parse valid or invalid utf-8} -constraints testbytestring -body { encoding convertto -stoponerror utf-8 "ZX\uD800" -} -returnCodes 1 -match glob -result "unexpected character at index 2: '\uD800' (U+00D800)" +} -returnCodes 1 -match glob -result "unexpected character at index 2: 'U+00D800'" file delete [file join [temporaryDirectory] iso2022.txt] # |