-
Notifications
You must be signed in to change notification settings - Fork 30.6k
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 - Git staging individual changes converts UTF-8 with BOM to UTF-8 #191413
Comments
Happens to me as well, and causes issues on the repos I'm a part of. I would very much like a solution to this. |
Me too. Not only with the Stage Selected Ranges command, but with Unstage Selected Ranges and Revert Selected Ranges, as well. |
Can confirm this unfixed as of 1.90.1 |
This bug is annoying when working on Visual Studio projects because Visual Studio creates BOMs by default, but VSCode silently removes them leading to a mix of encodings. |
Our old codebase uses mostly windows-1252, and we need to use this encoding. When we stage only selected ranges, it will commit the file as utf-8. This is very annoying. |
Right. It doesn't have anything to do with the BOM. Any encoding will be lost in favor of (BOM-less) UTF-8 regardless. |
Had another look into this today and realised it's a duplicate of #111915 so it should probably me marked as such |
Closing as duplicate of #111915 |
Type: Bug
The file in HEAD is now UTF-8, not UTF-8 with BOM. I.e. VSCode removed the EF BB BF bytes at the start of the file. The file in the current workspace is still UTF-8 with BOM, meaning if you now stage the whole file it will revert back to a UTF-8 with BOM file, but the history will show it first being converted to UTF-8, then back to UTF-8 with BOM.
This is not the same behaviour as staging individual changes with git add -p
VS Code version: Code 1.81.1 (6c3e3db, 2023-08-09T22:22:42.175Z)
OS version: Windows_NT x64 10.0.22621
Modes:
System Info
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
Extensions (17)
A/B Experiments
The text was updated successfully, but these errors were encountered: