diff --git a/packages/vue-renderer/src/renderers/spa.js b/packages/vue-renderer/src/renderers/spa.js
index 196e837491..8bb1a9969f 100644
--- a/packages/vue-renderer/src/renderers/spa.js
+++ b/packages/vue-renderer/src/renderers/spa.js
@@ -71,10 +71,18 @@ export default class SPARenderer extends BaseRenderer {
// BODY_ATTRS
meta.BODY_ATTRS = m.bodyAttrs.text()
+ // charset must come before the title to avoid encoding issues
+ let metaTags = m.meta.text()
+ const charset = m.meta.text({ charset: true })
+ if (charset) {
+ meta.HEAD += charset
+ metaTags = metaTags.replace(charset, '')
+ }
+
// HEAD tags
- meta.HEAD =
+ meta.HEAD +=
m.title.text() +
- m.meta.text() +
+ metaTags +
m.link.text() +
m.style.text() +
m.script.text() +
diff --git a/packages/vue-renderer/src/renderers/ssr.js b/packages/vue-renderer/src/renderers/ssr.js
index ed7aba75bf..e58b169ebc 100644
--- a/packages/vue-renderer/src/renderers/ssr.js
+++ b/packages/vue-renderer/src/renderers/ssr.js
@@ -130,7 +130,14 @@ export default class SSRRenderer extends BaseRenderer {
})
if (meta) {
- HEAD += meta.title.text() + meta.meta.text()
+ // charset must come before the title to avoid encoding issues
+ let metaTags = meta.meta.text()
+ const charset = meta.meta.text({ charset: true })
+ if (charset) {
+ HEAD += charset
+ metaTags = metaTags.replace(charset, '')
+ }
+ HEAD += meta.title.text() + metaTags
}
// Add