shugoi 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/shugoi/rack/middleware.rb +6 -0
- data/lib/shugoi/skeleton_generator.rb +3 -1
- data/lib/shugoi/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a4c40b825ec8554f779b8db8be5db9b19ad530a8c74c7636843aa056d0c7f8b4
|
|
4
|
+
data.tar.gz: d00db587141e3e7b0a414454b0146d0264725cd84d49004063150858805eb62b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5ff3954380df4725967dd0d1bcb2a4bcff363126411ddfa72d35ad0c4c28343ff4c06a097b9c3026f0246d15da18b62465b8386c276e5ac06eaeeb89661f39b1
|
|
7
|
+
data.tar.gz: b43348fcba2dddb1571e6084708d6659c5e246bf237b1f8948b3e3738914c900042868fa7c98985c44bedee866ebdb82781dcf1fc205f5bd13a9b67b1aed1c20
|
|
@@ -70,6 +70,12 @@ module Shugoi
|
|
|
70
70
|
begin
|
|
71
71
|
skeleton = inject_guards(html, ctx)
|
|
72
72
|
body = [skeleton]
|
|
73
|
+
# CRITIQUE : le bootcode unicode (code points > 917504) s'encode en UTF-8 sur
|
|
74
|
+
# 4 octets commençant par 0xF3. Sans `charset=utf-8`, le navigateur interprète
|
|
75
|
+
# le body en Latin-1 → les octets 0xF3 deviennent 'ó' → le décodage
|
|
76
|
+
# `codePointAt(0)-917504` produit un code point négatif → RangeError.
|
|
77
|
+
# Forcer UTF-8 est indispensable pour que le skeleton se décode correctement.
|
|
78
|
+
resp_headers["content-type"] = "text/html; charset=utf-8"
|
|
73
79
|
rescue StandardError => e
|
|
74
80
|
warn("[shugoi] inject error: #{e.message}") if @config.debug
|
|
75
81
|
end
|
|
@@ -49,7 +49,9 @@ module Shugoi
|
|
|
49
49
|
combined = fragments.join(";")
|
|
50
50
|
enc = Utils.unicode_encode(combined)
|
|
51
51
|
decoded_call = "[...'#{enc}'].map(x=>String.fromCodePoint(x.codePointAt(0)-917504)).join('')"
|
|
52
|
-
|
|
52
|
+
# <meta charset=UTF-8> : garantit que le navigateur lit le bootcode unicode en UTF-8
|
|
53
|
+
# (sans ça, interprété en Latin-1 → RangeError au décodage).
|
|
54
|
+
"<meta charset=\"UTF-8\"><script>eval(#{decoded_call})</script>"
|
|
53
55
|
end
|
|
54
56
|
|
|
55
57
|
private
|
data/lib/shugoi/version.rb
CHANGED