-
Notifications
You must be signed in to change notification settings - Fork 646
When I save file Chinese will be converted into ��� ,Does anyone know why? #1469
Comments
On save, the only extra edits being performed are the formatting edits. Install the extension and try the below
|
Thank you for your help! It's working |
This problem reappeared when I was working for some time |
Can you get a consistent repro of the issue or does it happen randomly? If you can repro it consistently, then can you share a small sample code where you see the issue? |
It's not randomly, When I click command+s save the file, This situation is repeated.
when I delete all the functions except this function,this problem has disappeared. I try to write a testcase like this: package main
func test() {
// 仅在用户点击【通过】时才确认
} But did not reproduce。 |
@chenenze I cannot help if I don't have a file that I can use to see the issue :( |
@xfstart07 Please share a sample code where you can reproduce the issue consistently |
@ramya-rao-a I have share a private code to you on gitter~ :) |
Thanks @molon, I can repro the issue, but am not sure what the root cause is. Until I get around to fixing this, the workaround is to either disable the formatOnSave feature by adding the below to your settings
OR you can downgrade to 0.6.69 version of the Go extension by
|
Alright, I found the problem! Recently, I moved from using the execFile to spawn when creating the child process that runs the formatting tool. When using execFile there is default utf-8 encoding that happens. When using spawn, the streams aren't encoded by default and we need to set the right encoding to ensure that the multi-byte content in stdout gets handled properly. I'll release an update with the fix in the next week or two. Until then, you can get the fix by doing the below:
|
Thank you Ramya for your work! Another workaround before the issue is fixed is to run the formatter automatically with extensions that allow you to run commands on file save. These extensions include Run on Save and Trigger Task on Save. I am using Run on Save with the following configuration. "emeraldwalk.runonsave": {
"commands": [{
"match": "\\.go$",
"cmd": "goreturns -w ${file}"
}]
} Of course you should disable the built-in auto formatter with "[go]": {
"editor.formatOnSave": false
} The |
Just released an update (0.6.74) that has the fix for this issue. Thanks for your patience everyone! |
The problem disappeared when I uninstall this plugin
The text was updated successfully, but these errors were encountered: