Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSR sometimes breaks utf8 characters in component props into individual bytes #46561

Closed
1 task done
vadzim opened this issue Feb 28, 2023 · 1 comment · Fixed by #46564
Closed
1 task done

SSR sometimes breaks utf8 characters in component props into individual bytes #46561

vadzim opened this issue Feb 28, 2023 · 1 comment · Fixed by #46564
Labels
bug Issue was opened via the bug report template.

Comments

@vadzim
Copy link
Contributor

vadzim commented Feb 28, 2023

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
Platform: linux
Arch: x64
Version: #1 SMP PREEMPT_DYNAMIC Mon Feb 6 11:26:13 UTC 2023
Binaries:
Node: 19.6.0
npm: 8.19.2
Yarn: 1.22.19
pnpm: N/A
Relevant packages:
next: 13.2.2-canary.3
eslint-config-next: 13.2.1
react: 18.2.0
react-dom: 18.2.0

Which area(s) of Next.js are affected? (leave empty if unsure)

App directory (appDir: true)

Link to the code that reproduces this issue

it reproduces randomly

To Reproduce

Render a "use client" components with props containing utf8 characters.
Sometimes utf8 characters are broken like that:

:I{"id":"(app-client)/./src/app/[lang]/login/Login.tsx","name":"Login","chunks":["app/[lang]/login/page:app/[lang]/login/page"],"async":false}\n9:["$","$La",null,{"lang":"ru","translations":{"sign_in":"Увайсьці","email_address":"Адрас e-mail","password":"Пароль","forgot_password":"Забыліся парoль?","remember_me":".За�"])</script><script>self.__next_f.push([1,"�омніць мяне"},"children":["$","$Lb",null,{}]}]\n"])</script>

выява

выява

Actually the broken string should be Запомніць мяне

Describe the Bug

The bug is in the use of the function decodeText in app-render.ts file.

The function decodeText has the second argument which should fix utf8 characters support, but it's not used in app-render.ts.

To not break utf8 characters the second argument to decodeText should be always provided.

Expected Behavior

Utf8 characters are not broken

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

@vadzim vadzim added the bug Issue was opened via the bug report template. label Feb 28, 2023
@kodiakhq kodiakhq bot closed this as completed in #46564 Feb 28, 2023
kodiakhq bot pushed a commit that referenced this issue Feb 28, 2023
Fix usage of textDecoder to prevent breaking utf8 characters

fixes #46561



## Bug

- [x] Related issues linked using `fixes #number`
// it's too hard to get a reproducible test 
// - Integration tests added
// error links are not needed 
// - Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)
@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant