diff options
author | Vitaly Takmazov | 2022-10-29 22:15:00 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-01-13 10:37:58 +0300 |
commit | d7fd6bee3230a2d6f82d6d1575ddb2ad10a0d881 (patch) | |
tree | 4f5ed17d0cc6082874b6fa7856887fc13e52c526 /vnext/src/index.js | |
parent | 48b2365a3b56b8a56bed7a77d2832ea51b617d6c (diff) |
Encode strings correctly
Diffstat (limited to 'vnext/src/index.js')
-rw-r--r-- | vnext/src/index.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/vnext/src/index.js b/vnext/src/index.js index 8064dd1f..5f3c262e 100644 --- a/vnext/src/index.js +++ b/vnext/src/index.js @@ -7,7 +7,16 @@ import './index.css'; const Juick = lazy(() => import('./App')); -const props = window.__PROPS__ ? JSON.parse(window.atob(window.__PROPS__)) : {}; +function fromBinary(encoded) { + const binary = window.atob(encoded); + const bytes = new Uint8Array(binary.length); + for (let i = 0; i < bytes.length; i++) { + bytes[i] = binary.charCodeAt(i); + } + return String.fromCharCode(...new Uint16Array(bytes.buffer)); +} + +const props = window.__PROPS__ ? JSON.parse(fromBinary(window.__PROPS__)) : {}; const JuickApp = () => ( <StrictMode> |