Skip to content
Tcl Source Code Artifact [22a7f497a9]
Login

Artifact [22a7f497a9]

Artifact 22a7f497a9f5582f293b3c91221c446239b1d62257699fbacef8a53e5fe6a1a0:

Ticket change [22a7f497a9] - Ticket [2da8d6fb3d26031a|2da8d6fb3d] <i>http doesn&#39;t respect charset for some content-types</i> status still Open with 4 other changes by andrew.brooks on 2018-11-08 18:12:31.
D 2018-11-08T18:12:31.011
J comment If\sa\sHTTP\srequest\smade\swith\sthe\shttp\spackage\sreceives\sa\sreply\swith\san\sexplicit\scharset\sin\sthe\sContent-Type\sheader,\sthe\scharset\swill\sonly\sbe\srespected\swhen\sdecoding\sthe\sreply\sfor\scertain\sContent-Types\s(text/*\sand\sseveral\sxml\stypes).\r\n\r\nThis\sbehavior\sis\sat\sodds\swith\sRFC2068,\ssection\s3.7.1\s('HTTP/1.1\srecipients\sMUST\srespect\sthe\scharset\slabel\sprovided\sby\sthe\ssender;\sand\sthose\suser\sagents\sthat\shave\sa\sprovision\sto\s"guess"\sa\scharset\sMUST\suse\sthe\scharset\sfrom\sthe\scontent-type\sfield\sif\sthey\ssupport\sthat\scharset').\r\n\r\nThe\sproblem\sis\seasy\sto\sreproduce:\r\n\r\n1.\sMake\sa\s::http::geturl\srequest\sto\sa\sserver\sthat\ssends\sa\sreply\swith\sheader\s'Content-Type:\sapplication/json;charset=UTF-8'\sand\sa\sbody\scontaining\sa\sUTF-8\swide\scharacter.\r\n2.\sCheck\sthe\sresponse\sbody\s(the\swide\scharacter\swill\sbe\smis-encoded).\r\n\r\nNote\sthat\sthis\sdoes\snot\shappen\sif\sthe\sContent-Type\sheader\sis\s'text;charset=UTF-8'\sor\s'application/xml;charset=UTF-8'.\r\n\r\nI\sfirst\snoticed\sthis\sbehavior\sin\s8.6.8,\sbut\sI\simagine\sthat\sit\shas\sbeen\saround\sfor\sa\swhile.\r\n\r\nI\shave\sattached\sa\spatch\s(written\sagainst\strunk)\sfor\sthe\shttp\spackage\sthat\scorrects\sthe\sproblem.
J icomment moved\spatch\sto\san\sattachment
J login andrew.brooks
J mimetype text/plain
K 2da8d6fb3d26031a8327b6bcda91f4fd158b71a8
U andrew.brooks
Z d9fae5e5abe7006953504372e08e3ec0