While not contesting the other answers, I think the following is worthy of mentioning.
http-equiv
) notation and the “short” one are equal, whichever comes first wins;<meta>
tags;You can test by running echo 'HTTP/1.1 200 OK\r\nContent-type: text/html; charset=windows-1251\r\n\r\n\xef\xbb\xbf<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta charset="windows-1251"><title>??????</title></head><body>??????</body></html>' | nc -lp 4500
and pointing your browser at localhost:4500
. (Of course you will want to change or remove parts. The BOM part is \xef\xbb\xbf
. Be wary of the encoding of your shell.)
Please mind that it's very important that you explicitly declare the encoding. Letting browsers guess can lead to security issues.