cryogen-project / cryogen

A simple static site generator written in Clojure
http://cryogenweb.org/
Eclipse Public License 1.0
1.09k stars 96 forks source link

Fix character rendering issue #258

Closed eihli closed 1 year ago

eihli commented 1 year ago

Without charset=utf-8 in the Content-Type header, some characters get incorrectly. I was seeing question marks. UTF-8 is quite ubiquitous so I don't think it's worth detecting this by way of parsing the meta tag out of a theme.

Without:

without-utf-8

With:

with-utf-8

yogthos commented 1 year ago

Thanks, that makes sense!

holyjak commented 1 year ago

Sorry for the late comment but this was not necessary. You can let it up to the users. F.ex. I have in my themes/lotus/html/base.html this:

<!DOCTYPE html>
<html lang="en" prefix="og: http://ogp.me/ns#">
    <head>
      <meta charset="utf-8"/>

and at the top of my /Users/holyjak/Projects/blog.jakubholy.net/themes/lotus/css/blog.css:

@charset "UTF-8";

Though you could argue that in 2022 it might make sense to force utf8 on everybody.

PS: Notice that the "serve-fast" functionality is broken wrt utf8 because Ring injects a piece of code before the meta, making it thus ignored. Perhaps that is what @eihli run into?