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

Copy and paste Chinese into Java String becomes garbled #3181

Closed
Faputa opened this issue Jul 5, 2023 · 11 comments · Fixed by eclipse-jdtls/eclipse.jdt.ls#2834
Closed

Copy and paste Chinese into Java String becomes garbled #3181

Faputa opened this issue Jul 5, 2023 · 11 comments · Fixed by eclipse-jdtls/eclipse.jdt.ls#2834

Comments

@Faputa
Copy link

Faputa commented Jul 5, 2023

Type: Bug

Like this.

image

Extension version: 1.20.0
VS Code version: Code 1.79.2 (695af097c7bd098fbf017ce3ac85e09bbc5dda06, 2023-06-14T08:57:04.379Z)
OS version: Windows_NT x64 10.0.19045
Modes:

System Info
Item Value
CPUs AMD Ryzen 5 PRO 4650U with Radeon Graphics (12 x 2096)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) undefined
Memory (System) 15.23GB (3.99GB free)
Process Argv --crash-reporter-id f5996097-ae46-4ad3-8875-a294c592650a
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
pythonvs932:30410667
py29gd2263:30776702
vsclangdc:30486549
c4g48928:30535728
dsvsc012:30540252
pynewext54:30695312
azure-dev_surveyone:30548225
vsccc:30610678
3biah626:30602489
pyind779:30671433
f6dab269:30613381
pythonsymbol12:30671437
a9j8j154:30646983
showlangstatbar:30737416
vsctsb:30748421
pythonms35:30701012
pythonfmttext:30731395
pythoncmvfstrcf:30756944
fixshowwlkth:30771522
pythongtdpath:30769146
i26e3531:30780429
pythonnosm12tcf:30779713
pythonidxpt:30772539
pythonnoceb:30776495
e537b577:30772215

@mozhuanzuojing
Copy link

更新vscode1.80.0就好了

@wufeiwua
Copy link

wufeiwua commented Sep 4, 2023

I'm just as confused. It looks like it gets replaced by Unicode when I put Chinese characters in "Java String". I'm not sure if this is due to Red Hat's "Language Support for Java(TM) by Red Hat". BTW. my vscode version is "Version: 1.81.1 (Universal)
Commit: 6c3e3dba23e8fadc360aed75ce363ba185c49794", and extension version is "v1.21.0"

@fbricon
Copy link
Collaborator

fbricon commented Sep 4, 2023

You can disable vscode-java's paste feature with

"[java]": {
   "editor.pasteAs.enabled": false
},

@wufeiwua
Copy link

wufeiwua commented Sep 4, 2023

You can disable vscode-java's paste feature with

"[java]": {
   "editor.pasteAs.enabled": false
},

It's working. Thanks very much.

@testforstephen
Copy link
Collaborator

I'm just as confused. It looks like it gets replaced by Unicode when I put Chinese characters in "Java String". I'm not sure if this is due to Red Hat's "Language Support for Java(TM) by Red Hat". BTW. my vscode version is "Version: 1.81.1 (Universal) Commit: 6c3e3dba23e8fadc360aed75ce363ba185c49794", and extension version is "v1.21.0"

@wufeiwua What's your OS system locale? And what encoding is used in Java file?

@wufeiwua
Copy link

wufeiwua commented Sep 4, 2023

I'm just as confused. It looks like it gets replaced by Unicode when I put Chinese characters in "Java String". I'm not sure if this is due to Red Hat's "Language Support for Java(TM) by Red Hat". BTW. my vscode version is "Version: 1.81.1 (Universal) Commit: 6c3e3dba23e8fadc360aed75ce363ba185c49794", and extension version is "v1.21.0"

@wufeiwua What's your OS system locale? And what encoding is used in Java file?

My OS is "macOS Ventura 13.5.1", and the file encoding is "UTF-8". But the bug can also be reproduced on Windows OS.

@testforstephen
Copy link
Collaborator

I tried in the following environment, copy & paste Chinese characters works for me. Could you confirm these environment info? thanks.

  • VS Code@1.81.1
  • Windows locale: English (Unit States)
  • File Encoding: UTF-8

@Faputa
Copy link
Author

Faputa commented Sep 4, 2023

I tried in the following environment, copy & paste Chinese characters works for me. Could you confirm these environment info? thanks.

  • VS Code@1.81.1
  • Windows locale: English (Unit States)
  • File Encoding: UTF-8

image

@Faputa Faputa closed this as completed Sep 4, 2023
@Faputa Faputa reopened this Sep 4, 2023
@testforstephen
Copy link
Collaborator

@Faputa thanks for the info. In your original issue, you're using VS Code@1.79.2. Did you try the latest VS Code version (e.g. 1.81)?

@Faputa
Copy link
Author

Faputa commented Sep 4, 2023

@Faputa thanks for the info. In your original issue, you're using VS Code@1.79.2. Did you try the latest VS Code version (e.g. 1.81)?

Yes, I am using the 1.81.1 version of vscode and it still does this.

@testforstephen
Copy link
Collaborator

Reproduced.

If the cursor is not inside "" (e.g. System.out.println(|)), pasting Chinese characters there will still get Chinese characters.
If the cursor is inside "" (e.g. System.out.println("|")), pasting Chinese characters there will get unicode characters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants