summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-05-11 19:08:45 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-05-11 19:08:45 (GMT)
commitc716b6f26454cf2ff3e65c2e9f65db7b99c5ba63 (patch)
treefcd88cbe68090bd3a0ada279644152eec4a76cec
parent58fb3e0d99066c48bb9249624f61972f8c4e0778 (diff)
parent9beeb77bd585a1ea73c66d0c4161770fa57f9a98 (diff)
downloadtcl-c716b6f26454cf2ff3e65c2e9f65db7b99c5ba63.zip
tcl-c716b6f26454cf2ff3e65c2e9f65db7b99c5ba63.tar.gz
tcl-c716b6f26454cf2ff3e65c2e9f65db7b99c5ba63.tar.bz2
Merge 8.7
-rw-r--r--library/http/http.tcl5
-rw-r--r--tests/http.test21
2 files changed, 25 insertions, 1 deletions
diff --git a/library/http/http.tcl b/library/http/http.tcl
index 8bfec44..187d203 100644
--- a/library/http/http.tcl
+++ b/library/http/http.tcl
@@ -3590,7 +3590,7 @@ proc http::CharsetToEncoding {charset} {
set encoding "iso8859-$num"
} elseif {[regexp {iso-?2022-(jp|kr)} $charset -> ext]} {
set encoding "iso2022-$ext"
- } elseif {[regexp {shift[-_]?js} $charset]} {
+ } elseif {[regexp {shift[-_]?jis} $charset]} {
set encoding "shiftjis"
} elseif {[regexp {(?:windows|cp)-?([0-9]+)} $charset -> num]} {
set encoding "cp$num"
@@ -3602,6 +3602,9 @@ proc http::CharsetToEncoding {charset} {
1 - 2 - 3 {
set encoding "iso8859-$num"
}
+ default {
+ set encoding "binary"
+ }
}
} else {
# other charset, like euc-xx, utf-8,... may directly map to encoding
diff --git a/tests/http.test b/tests/http.test
index 3b2963e..d1513bf 100644
--- a/tests/http.test
+++ b/tests/http.test
@@ -113,6 +113,27 @@ test http-1.6 {http::config} -setup {
test http-2.1 {http::reset} {
catch {http::reset http#1}
} 0
+test http-2.2 {http::CharsetToEncoding} {
+ http::CharsetToEncoding iso-8859-11
+} iso8859-11
+test http-2.3 {http::CharsetToEncoding} {
+ http::CharsetToEncoding iso-2022-kr
+} iso2022-kr
+test http-2.4 {http::CharsetToEncoding} {
+ http::CharsetToEncoding shift-jis
+} shiftjis
+test http-2.5 {http::CharsetToEncoding} {
+ http::CharsetToEncoding windows-437
+} cp437
+test http-2.6 {http::CharsetToEncoding} {
+ http::CharsetToEncoding latin5
+} iso8859-9
+test http-2.7 {http::CharsetToEncoding} {
+ http::CharsetToEncoding latin1
+} iso8859-1
+test http-2.8 {http::CharsetToEncoding} {
+ http::CharsetToEncoding latin4
+} binary
test http-3.1 {http::geturl} -returnCodes error -body {
http::geturl -bogus flag