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

Encoding Issue with Special Characters in Node.js 22 Docker Image #54746

Closed
newtonaugusto opened this issue Sep 3, 2024 · 1 comment
Closed
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs. invalid Issues and PRs that are invalid.

Comments

@newtonaugusto
Copy link

Version

22

Platform

Node.js Version: 22 (Docker Image: any node:22)
Operating System: Linux (inside Docker container)
Locale settings attempted: pt_BR.UTF-8, LC_ALL=pt_BR.UTF-8, LANG=pt_BR.UTF-8

Subsystem

No response

What steps will reproduce the bug?

  1. Clone the following repository: GitHub Repository
  2. Build and run the application using the Node.js 22 Docker image: Alternatively, you can pull the pre-built Docker image: itacirgabral/node22alpinetestencode:0.0.1
  3. Access the endpoint /status-encoding and observe the returned string containing special characters such as "Teste: coração".
  4. Use the wrk tool to perform a load test on the application to increase the chances of encountering the encoding issue:
  1. Observe the output, especially when using Buffer.from('Teste: coração').toString('utf8').

How often does it reproduce? Is there a required condition?

The issue occurs intermittently, especially under load. While it doesn't happen every time, it is more likely to appear when performing high-volume requests, such as during a load test with tools like wrk. The problem seems to be tied to the use of special characters in strings and their encoding within the Node.js 22 Docker images.

What is the expected behavior? Why is that the expected behavior?

The expected behavior is that special characters, such as "ç" in the string "coração", should be correctly encoded and displayed as intended in all cases. This is the expected behavior because proper encoding ensures that applications handle and display text consistently across different environments and loads, which is critical for applications that process multilingual data or require consistent text representation.

image

image

What do you see instead?

Instead of correctly displaying "coração", the output sometimes shows "cora��o", indicating that the special character "ç" is being mishandled or incorrectly encoded.

Additional information

  • The issue seems specific to the Node.js 22 Docker images (node:22 and node:22-alpine). When tested with Node.js 18 or 21 images, the encoding issue did not occur.
  • Locale settings (pt_BR.UTF-8) were explicitly set in the Dockerfile, but the problem persists.
  • The issue appears to be exacerbated under load, suggesting a possible race condition or misconfiguration related to encoding within the image.
  • This encoding issue could potentially affect other applications running on Node.js 22 within Docker containers, especially those dealing with internationalization or special character handling.
@RedYetiDev RedYetiDev closed this as not planned Won't fix, can't repro, duplicate, stale Sep 3, 2024
@RedYetiDev RedYetiDev added duplicate Issues and PRs that are duplicates of other issues or PRs. invalid Issues and PRs that are invalid. labels Sep 3, 2024
@RedYetiDev
Copy link
Member

Please upgrade to v22.8.0 to resolve this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs. invalid Issues and PRs that are invalid.
Projects
None yet
Development

No branches or pull requests

2 participants