Vscode-cpptools: The behavior of VS Code's "files.autoGuessEncoding" setting is not replicated when opening files directly from disk

Created on 17 Dec 2019  路  6Comments  路  Source: microsoft/vscode-cpptools

From: https://github.com/microsoft/vscode/issues/87160

Issue Type: Bug

Steps

  • Create .h and .cpp files (with different encoding)
  • Add comments in Chinese to functions in .h file (encoding: GB2312)
  • Use the predefined function in .cpp file (encoding: utf-8)
  • Trigger C++ suggestions

Results

  • In .h file, the commnet texts were rendered as expected.

image

  • In .cpp file, the comment texts got bad encoding.

image

Version

VS Code version: Code 1.41.0 (9579eda04fdb3a9bba2750f15193e5fafe16b959, 2019-12-11T18:37:42.077Z)
OS version: Windows_NT x64 10.0.18362
Remote OS version: Linux x64 3.10.107-1-tlinux2_kvm_guest-0049


System Info

|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz (8 x 3408)|
|GPU Status|2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off
surface_control: disabled_off
surface_synchronization: enabled_on
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off
webgl: enabled
webgl2: enabled|
|Load (avg)|undefined|
|Memory (System)|15.89GB (9.43GB free)|
|Process Argv||
|Screen Reader|no|
|VM|0%|

|Item|Value|
|---|---|
|Remote|SSH: docker|
|OS|Linux x64 3.10.107-1-tlinux2_kvm_guest-0049|
|CPUs|Intel(R) Xeon(R) CPU E5-26xx v4 (8 x 3199)|
|Memory (System)|15.42GB (1.76GB free)|
|VM|0%|


Language Service bug world ready

All 6 comments

We only support UTF-8 currently. We're tracking adding support for other encodings with https://github.com/microsoft/vscode-cpptools/issues/414 .

Closing duplicate issue.

@BOT-Man-JL Should be fixed with https://github.com/microsoft/vscode-cpptools/releases/tag/0.30.0-insiders4 . Let us know if you see any remaining bugs with non-UTF-8 encodings.

@BOT-Man-JL Should be fixed with https://github.com/microsoft/vscode-cpptools/releases/tag/0.30.0-insiders4 . Let us know if you see any remaining bugs with non-UTF-8 encodings.

@sean-mcmanus It still has this problem...

image
image

Hi @BOT-Man-JL . It's not mentioned here, but have you set VS Code's files.encoding setting to GB2312? The C/C++ Extension does not replicate VS Code's files.autoGuessEncoding behavior when opening files directly from disk, but should now use files.encoding when opening files from disk (if the file does not have a BOM, and is not UTF16 LE/BE). If you are setting files.encoding and not getting the proper text, that may be a bug in 0.30.0-insiders4. If you are expecting the encoding to be auto-detected without setting files.encoding, this issue should be re-opened and de-duped from https://github.com/microsoft/vscode-cpptools/issues/414 , as that is not currently supported.

Hi @Colengms, my files.encoding was not set.

In my scenario, I suppose that files.autoGuessEncoding is necessary because each document is either UTF-8 or GB2312 (not the same encoding), or maybe other encoding.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

igorPhelype picture igorPhelype  路  3Comments

peterwoods1 picture peterwoods1  路  3Comments

ismadelgad11 picture ismadelgad11  路  3Comments

montery8 picture montery8  路  3Comments

vicatcu picture vicatcu  路  3Comments