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

Garbled characters appear when setting Chinese title #2932

Closed
2 tasks
BabyCY opened this issue Jan 10, 2022 · 3 comments
Closed
2 tasks

Garbled characters appear when setting Chinese title #2932

BabyCY opened this issue Jan 10, 2022 · 3 comments

Comments

@BabyCY
Copy link

BabyCY commented Jan 10, 2022

  • I have read the FAQ.
  • I have searched in existing issues.

Environment

  • OS: Windows
  • scrcpy version: 1.21
  • installation method: Windows release
  • device model: Pixel 2 XL
  • Android version: 11

Describe the bug
Garbled characters appear when setting Chinese title

微信截图_20220110093928
微信截图_20220110094428

PS D:\soft\scrcpy-win64-v1.21> .\scrcpy.exe -s 806KPSL1950254 --window-title 中文标题hello
scrcpy 1.21 https://github.com/Genymobile/scrcpy
D:\soft\scrcpy-win64-v1.21\scrcpy-server: 1 file pushed, 0 skipped. 63.2 MB/s (40067 bytes in 0.001s)
[server] INFO: Device: Google Pixel 2 XL (Android 11)
INFO: Renderer: direct3d
INFO: Initial texture: 1440x2880

@rom1v
Copy link
Collaborator

rom1v commented Jan 10, 2022

Thank you for your report.

On Windows, command line arguments should probably be read by GetCommandLineW(), then converted to argv style using CommandLineToArgvW(), then each argument should be converted from wchar_t to UTF-8. Unless there is a simpler solution? (@npes87184, any clue?)

@Mapaler
Copy link

Mapaler commented Oct 1, 2022

I have the same problem.
1664615030261_WindowsTerminal

The current solution is:
Use UTF-8 to save text first.
1664615672872_explorer
Open this text file using ANSI (GBK).
1664615687890_explorer
Using these garbled character in the console can get the correct Chinese characters.
1664615708923_WindowsTerminal
Description scrcpy will do an additional operation to convert string buffers from ANSI to UTF-8.

@npes87184
Copy link
Contributor

On Windows, command line arguments should probably be read by GetCommandLineW(), then converted to argv style using CommandLineToArgvW(), then each argument should be converted from wchar_t to UTF-8

image

Use of the way you suggested worked well. I also tried using wmain with the link flag -municode, but that way didn't work.

rom1v pushed a commit that referenced this issue Oct 23, 2022
PR #3547 <#3547>
Fixes #2932 <#2932>

Signed-off-by: Yu-Chen Lin <[email protected]>
Signed-off-by: Romain Vimont <[email protected]>
npes87184 added a commit to npes87184/scrcpy that referenced this issue Oct 23, 2022
rom1v pushed a commit that referenced this issue Oct 23, 2022
PR #3547 <#3547>
Fixes #2932 <#2932>

Signed-off-by: Yu-Chen Lin <[email protected]>
Signed-off-by: Romain Vimont <[email protected]>
@rom1v rom1v closed this as completed in 48bb6f2 Dec 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants