vscode-perforce
vscode-perforce copied to clipboard
Add support for P4CHARSET (-C)
Thank you for updating this extension. It helps when I use VS Code with Perforce.
I encountered a problem with my environment. My PC is running Windows in codepage 932 (GBK), and P4 connection encoding set to utf8. This is a common environment in my workplace.
When files are modified, I noticed that some files got strange "changed" gutter in inline diff view, both in VS Code and in IntelliJ. Diff shows that the lines in Chinese (comments) were in gibberish, hence the "changed" status. Actual file contents and submissions are okay. With some trial-and-errors, the "encoding" option in IntelliJ's Perforce plugin solved my problem:
It has to be set to
utf8 in order for inline diff to work correctly.
With further investigation, I found out that the files involved have unicode filetype; the gibberish are actually GBK sequences interpreted with UTF-8.
So it appears to be the P4CHARSET env var, or -C global option. With this set to the correct server encoding (utf8 in my case), false "changed" gutters are gone.
This PR featured more encodings, appeared in P4V (also the P4 plugin for IntelliJ) for old P4 servers, and in docs for recent P4 servers.