-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
Git - "Stage Selected Ranges" creates a "Staged Changes" file of type UTF-8 when the orginal file is ANSI (Windows 1252) #111915
Comments
@jekitf I think that utf8 is ok, but the one 2 lines above it might be the issue. But not sure. I won't really be able to look at this this iteration at least, so any testing/PR that you can provide would be greatly appreciated. |
Facing a similar issue. Related to #36219? Edit: "sas.files.encoding": "windows1252", |
This problem also occurs with Shift-JIS files.
Steps to Reproduce:
{
"files.encoding": "shiftjis"
}
|
#84130 has addressed the problem related to encoding when files are being shown in the diff editor. Unfortunately it did not address the encoding related issue when it comes to the "Stage Selected Ranges" command. Fixing the "Stage Selected Ranges" command is currently blocked on #824 as at the moment extensions do not have access to the encoding of the text document. |
I also run into this today. Why does this issue exist yet? |
The viciousness of this bug is that the corrupted files manifest themselves very late in git history, when eg bisecting old commits and discovering differences in irrelevant but huge ranges of text due to EOLs. |
Is
|
I tried to create an extension to add a "Stage Selected Range (ANSI)" command for ANSI to work around this problem, but it was not possible because the |
This issue requires an API for encoding, but the issue of adding this API(#824) has remained open for 6 years. Also, adding such a core API would be difficult for the average contributor. |
It is true that GIT always stores files in UTF-8 encoding on a remote server. |
Don't be misleading, that's not the case "always", but depends on settings in |
Is there an update to this issue? I also opened an issue on VSCodium's GitHub: VSCodium/vscodium#1418 I have reproduced and documented the current problem in two examples. The difference between the two use cases is the use of a .gitattributes. The post has become a little longer than planned. Case 1
Case 2
Detailssettings.json
|
I had this problem today. Running version 1.85.1. Thought I'd make a comment to give this issue a kick, since this issue is three years old. :) |
Can this bug be prioritized higher? Silently changing files is a significant bug. Many users are likely running into this bug without realizing it. If it breaks something later, they might not find the original cause. |
Is there any update on this? I think it is very important for a text editor to not silently make unwanted changes to files. |
Issue Type: Bug
--
--
The file have the content: C3 98 C3 86 C3 85 0D 0A 2D
Expected content: D8 C6 C5 0D 0A 2D
The file have been changed from ANSI to UTF-8 in git.
In C++ using "Use Multi-Byte Character Set" this is a fatal bug
VS Code version: Code 1.51.1 (e5a624b, 2020-11-10T23:34:32.027Z)
OS version: Windows_NT x64 10.0.19041
System Info
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
opengl: enabled_on
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Extensions (9)
The text was updated successfully, but these errors were encountered: