Posted to tcl by Colin at Tue Sep 18 23:53:55 GMT 2007view pretty

	# handle charset for text/* types
	lassign [split [Dict get? $reply content-type] {;}] ct
	if {[string match text/* $ct]} {
	    if {[dict exists $reply -charset]} {
		set charset [dict get $reply -charset]
	    } else {
		set charset utf-8	;# default charset
	    }
	    dict set reply -charset $charset
	    dict set reply -chconverted $charset
	    dict set reply content-type "$ct; charset=$charset"
	    dict set reply -content [encoding convertto $charset [dict get $reply -content]]
	}