3 ms·
> Another interesting point is that Chrome can load utf-8 documents as utf-8 without a metatag if it's a file:// URL. I guess conceptually this is because local
by tjungblut 5y ago
> Another interesting point is that Chrome can load utf-8 documents as utf-8 without a metatag if it's a file:// URL. I guess conceptually this is because local files can't specify the encoding in HTTP headers or something?
You can guess the encoding after reading a few bytes from the request. Checkout universalchardet from Mozilla or the equivalent Java port: https://github.com/albfernandez/juniversalchardet https://github.com/albfernandez/juniversalchardet
By the time the meta tag is parsed, you almost always know the right encoding already.