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

Fix chaotic chinese characters with golang cli commands #18386

Merged
merged 1 commit into from
Nov 7, 2023

Conversation

twalluxio
Copy link
Contributor

When debugging load command, it is found that ./bin/alluxio CLI can't process Chinese characters correctly. There must be something wrong with the CLI encoding or decoding. It seems that the Chinese characters are encoded incorrectly.

This happens because the construction of CLI commands does not initialize environmental variables correctly. OS-level environmental variables are ignored, so the program uses a false encoder.

This pull request fixes this problem.

@twalluxio twalluxio marked this pull request as ready for review November 7, 2023 09:19
@Kai-Zhang
Copy link
Contributor

Kai-Zhang commented Nov 7, 2023

i think the java subprocess should inherit the environment variables from the go CLI process. it does so by default but not when we change the Env field. https://pkg.go.dev/os/exec#Cmd. @Xenorith
cc @JiamingMai

Copy link
Contributor

@Xenorith Xenorith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this fix makes sense and i am surprised it has such an impact. thanks for investigating and resolving the bug!

@Xenorith Xenorith added the type-bug This issue is about a bug label Nov 7, 2023
@Xenorith
Copy link
Contributor

Xenorith commented Nov 7, 2023

alluxio-bot, merge this please

@alluxio-bot alluxio-bot merged commit 7d15de7 into Alluxio:main Nov 7, 2023
12 checks passed
@twalluxio twalluxio deleted the fix-cli-not-support-chinese branch November 8, 2023 02:03
@jiacheliu3
Copy link
Contributor

alluxio-bot, cherry-pick this to branch-3-1.1.x please

alluxio-bot pushed a commit that referenced this pull request Nov 8, 2023
When debugging load command, it is found that `./bin/alluxio` CLI can't process Chinese characters correctly. There must be something wrong with the CLI encoding or decoding. It seems that the Chinese characters are encoded incorrectly.

This happens because the construction of CLI commands does not initialize environmental variables correctly. OS-level environmental variables are ignored, so the program uses a false encoder.

This pull request fixes this problem.
			pr-link: #18386
			change-id: cid-a15fb106b4a6cd77087cdbba82e426f1ba1e4b4c
@alluxio-bot
Copy link
Contributor

Auto cherry-pick to branch branch-3-1.1.x successfully opened PR: #18394

alluxio-bot added a commit that referenced this pull request Nov 8, 2023
Cherry-pick of existing commit.
orig-pr: #18386
orig-commit: 7d15de7
orig-commit-author: twalluxio <[email protected]>

			pr-link: #18394
			change-id: cid-a15fb106b4a6cd77087cdbba82e426f1ba1e4b4c
ssz1997 pushed a commit to ssz1997/alluxio that referenced this pull request Dec 15, 2023
When debugging load command, it is found that `./bin/alluxio` CLI can't process Chinese characters correctly. There must be something wrong with the CLI encoding or decoding. It seems that the Chinese characters are encoded incorrectly.

This happens because the construction of CLI commands does not initialize environmental variables correctly. OS-level environmental variables are ignored, so the program uses a false encoder.

This pull request fixes this problem.
			pr-link: Alluxio#18386
			change-id: cid-a15fb106b4a6cd77087cdbba82e426f1ba1e4b4c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug This issue is about a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants