News for hackers. Stuff that matters.
Re:Show HN: This website is valid JSON by bogidon on Tuesday December 08, 2020 @10:10PM (#25354881)
Hey! Yes, however now I notice that this is only when running locally. I took your page, replaced script and css with absolute links, and loaded locally as file://
Re:Show HN: This website is valid JSON by gpnt on Tuesday December 08, 2020 @10:27PM (#25354993)
hmm, I didn't find this error locally either. I will try using file://. Thanks for the report.

Also, if you are interested, the project is on GitHub: https://github.com/webdatarender

Re:Show HN: This website is valid JSON by missblit on Wednesday December 09, 2020 @12:55AM (#25355767)
The reason it works locally is because charset detection works different when loading from a local file than when loading from a webserver.

In particular browsers tend to be a lot more enthusiastic about treating local files as unicode than they are for responses from web servers.

The reason the meta charset doesn't pick up is you're missing quotes around `utf-8` (also it may be past the 1024 byte mark, hard to say without running wc).

Re:Show HN: This website is valid JSON by necovek on Wednesday December 09, 2020 @02:43AM (#25356293)
The reason browsers' charset autodetection works differently locally is likely because HTTP standard specifies Latin1 (ISO-8859-1) as the default encoding (at least in 1.1).
Re:Show HN: This website is valid JSON by myfonj on Wednesday December 09, 2020 @07:18AM (#25357790)
Or server sends explicit charset in HTTP header (`Content-Type: text/html; charset=UTF-8`), so meta element override is not needed at all. Naturally, there is no such header present in file:///.