Open mrcnski opened 9 months ago
I think this might be because astro-seo
currently puts the <meta charset="UTF-8" />
tag after the title
tag. I'm going to create a separate issue for that.
Thank you for reporting this @mrcnski and really good catch @ttmc, we'll discuss possible solutions to this in #91
Just to confirm that this might actually be the issue behind this: do you use the charset
tag via astro-seo
@mrcnski?
Hey @jonasmerlin, I didn't set charset
because I thought that it would default to UTF-8 if not provided. If that's not true, maybe the docs could be clarified?
@mrcnski While modern browsers like Chrome strongly prefer UTF-8 as the default charset for websites without explicit declaration, there isn't a single guaranteed assumption. It's a multi-step process with multiple fallback options... here's what Chrome does:
Content-Type
header in the HTTP response. This header can explicitly specify the charset used, and if it mentions UTF-8, that will be used.<meta charset="utf-8">
tag within the HTML document itself. If present, this explicitly declares UTF-8 as the encoding.However, relying on browser guessing and fallback defaults is strongly discouraged for several reasons:
Therefore, it's essential for website developers to explicitly declare the character encoding using either the Content-Type
header or the <meta charset>
tag, preferably using UTF-8 due to its widespread adoption and compatibility.
Thanks for the detailed explanation @ttmc. For some reason I thought that astro-seo would set a default of UTF-8 if this field was omitted. I can see why we wouldn't want to set default any values, as they may be already set outside of the
Set the charset of the document. In almost all cases this should be UTF-8.
@mrcnski Over on issue #91, one suggestion has been to make the astro-seo integration check if the charset gets set to UTF-8 (by something or someone other than the astro-seo integration), and if it hasn't been set, then the integration will inject the charset declaration at the top of the head.
Thanks for the utility! I think I've found a bug. It seems that setting the
<SEO title=
field to some unicode breaks the generated HTML: