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

Encoding issues #40

Closed
bizoo opened this issue Mar 3, 2017 · 14 comments
Closed

Encoding issues #40

bizoo opened this issue Mar 3, 2017 · 14 comments
Assignees
Labels
bug Something isn't working

Comments

@bizoo
Copy link

bizoo commented Mar 3, 2017

There is some issues when encoding of files in Git is not UTF-8.
If I have a file opened in vscode encoded in Windows 1252 (this is my default encoding for my workspace),
when using the Compare with ... command, the files from Git (not the current one in the Working folder) is displayed with the wrong encoding.

To replicate:

  1. Create a new file and put this text inside: référence
  2. Save it with encoding Windows 1252
  3. Commit it in a Git repository
  4. Modify it and use Compare with Working Tree to show the difference

The current file is OK but the one in Git is wrong (garbage instead of é).
I think the encoding from the current file in vscode must be used to decode the files from Git.

@eamodio eamodio added the bug Something isn't working label Mar 3, 2017
@eamodio eamodio self-assigned this Mar 3, 2017
@eamodio
Copy link
Member

eamodio commented Mar 3, 2017

@bizoo Thanks for the report -- I'll take a look into it.

@eamodio
Copy link
Member

eamodio commented Mar 15, 2017

@bizoo does the built-in git diff in vscode work for you? I'm seeing the same behavior with the vscode git diff as with GitLens.

@eamodio
Copy link
Member

eamodio commented Mar 15, 2017

@bizoo I don't think there is currently a way I could fix this. Git itself doesn't know about the file encoding -- and vscode doesn't provide a way (as far as I can tell) to know what encoding the file is opened as.

If you or anyone else has any ideas I'm all ears :)

@eamodio eamodio added help wanted Want community input and/or pull request needs-more-info Needs further information, steps, details, etc. labels Mar 15, 2017
@bizoo
Copy link
Author

bizoo commented Mar 16, 2017

You're correct, vscode doesn't handle it very well:

  • If I put my encoding as default ("files.encoding": "windows1252") in my settings (either workspace or user), built-in git diff in vscode work for me on the same source file that show issues in GitLens.
  • If I don't and use the Reopen with encoding to change the encoding, I see the same issues (and even more).

I suppose that it works in vscode because it open the files from git using a different API that respect the file encoding from settings.

So even vscode itself doesn't fully support encoding in git, I'll open an issue for it.
If you can do something in GitLens to work like vscode and respect the encoding setting for all files you open, it would be great.

By the way, thanks for this great plugin.

@bizoo
Copy link
Author

bizoo commented Mar 16, 2017

An issues is already filled:
microsoft/vscode#21146

And it's incorporated in the March Iteration Plan 👍

@bizoo
Copy link
Author

bizoo commented Mar 16, 2017

And you're correct about getting encoding of a file:
microsoft/vscode#824

@bizoo bizoo closed this as completed Mar 16, 2017
@bizoo
Copy link
Author

bizoo commented Mar 16, 2017

Oups, closed by error...

@bizoo bizoo reopened this Mar 16, 2017
@eamodio
Copy link
Member

eamodio commented Mar 16, 2017

@bizoo Thanks for the updates! I will look into adding support for the files.encoding setting.

@eamodio eamodio removed help wanted Want community input and/or pull request needs-more-info Needs further information, steps, details, etc. labels Mar 16, 2017
@bizoo
Copy link
Author

bizoo commented May 5, 2017

Following this comment:
microsoft/vscode#21146 (comment)

I tried the new git SCM integration and now the encoding works like before (the encoding of the files.encoding settings is always used), but it doesn't change anything for Git Lens.
Do you think it's possible to have the same behavior in Git Lens ?

@eamodio
Copy link
Member

eamodio commented May 5, 2017

@bizoo I will take a look at what was added and see if I can get that in to GitLens

@eamodio
Copy link
Member

eamodio commented May 24, 2017

@bizoo Sorry for the long delay, but can you try the new beta here: v3.5.0-beta.2? You can find installation instructions here: Installing Beta Releases

@bizoo
Copy link
Author

bizoo commented May 29, 2017

Sorry for the late answer, was on vacation.
Tried reproduce the encoding issues with build 3.5.1 and everything works as expected.
So GitLens as the same behavior as VSCode SCM.
Sad the set/get encoding from file (view) is still not supported in VSCode.

Thanks for your hard works.

@jjasoncool
Copy link

jjasoncool commented Dec 14, 2018

My file encoding is big5
In the vscode SMC is will auto show view encoding in big5, but always utf8 in gitlens.

This behavior after version 9.
In the version 8.5.6 is normal.
Thank you!

billsedison added a commit to noside911/vscode-gitlens that referenced this issue Jan 4, 2019
@github-actions
Copy link

github-actions bot commented Dec 4, 2020

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants