Overview
| Artifact ID: | 1daae07366b4b4899d42a2b6273bc6fedd68743f |
|---|---|
| Ticket: | 838e99a76dd54f1961b8b5c4bdb3da114bf5b6f8
treat application/xml as text |
| User & Date: | gahr on 2016-09-25 16:05:00 |
Changes
- icomment:
Some evidence that the current behaviour is weird, to say the least. Given these two URLs (available for anyone to check out) and the script below: https://www.ptrcrt.ch/838e99a76d/utf8.html https://www.ptrcrt.ch/838e99a76d/utf8.xhtml ================================================== #!/usr/local/bin/tclsh8.6 package require http 2 package require tls ::http::register https 443 ::tls::socket puts "Tcl version : [info patchlevel]" puts "http version: [package present http]" puts {} set tok [::http::geturl [lindex $argv 0]] foreach {k v} [::http::meta $tok] { puts "$k: $v" } puts {} puts [::http::data $tok] ================================================== The two outputs are the following: ================================================== % tclsh8.6 testurl.tcl https://www.ptrcrt.ch/838e99a76d/utf8.html Tcl version : 8.6.6 http version: 2.8.9 Server: nginx Date: Sun, 25 Sep 2016 15:58:52 GMT Content-Type: text/html; charset=utf-8 Last-Modified: Sun, 25 Sep 2016 15:54:18 GMT Transfer-Encoding: chunked Connection: close ETag: W/"57e7f32a-53" Content-Encoding: gzip <!DOCTYPE html> <html><head><title>üäö</title></head><body>üäö</body></html> ================================================== and ================================================== % tclsh8.6 testurl.tcl https://www.ptrcrt.ch/838e99a76d/utf8.xhtml Tcl version : 8.6.6 http version: 2.8.9 Server: nginx Date: Sun, 25 Sep 2016 15:59:10 GMT Content-Type: application/xhtml+xml Content-Length: 289 Last-Modified: Sun, 25 Sep 2016 15:52:43 GMT Connection: close ETag: "57e7f2cb-121" Accept-Ranges: bytes <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><title>üäö</title></head><body>üäö</body></html> ================================================== There is no reason why the application/xhtml+xml content shouldn't be correctly decoded by the http package. Also, my patch above would need to be modified to match application/xml and application/*+xml. - login: "gahr"
- mimetype: "text/plain"
- username: "gahr"