1

I've set up clang-format to automatically format the code when compiling, but it replaces certain characters with question marks. For example:

// Copyright © Someone

Becomes

// Copyright ? Someone

I'm using the CodeBeautifier plugin in Visual Studio 2015. When I enable the Use source file encoding option, it displays as follows:

// Copyright � Someone

The Type is set to StdInput, because when I select File it waits for user input, and freezes Visual Studio.

How do I prevent characters like those from being encoded incorrectly?

Broxzier
  • 2,909
  • 17
  • 36

1 Answers1

1

This is because the character is saved to utf-8. Appearently, MSVC does not recognize it corretly.

This could help: How to set standard encoding in Visual Studio. Additionally, within Options/Text Editor, activate 'Auto-detect UTF-8 encoding without signature'.

Community
  • 1
  • 1
Aconcagua
  • 24,880
  • 4
  • 34
  • 59
  • The problem does not occur when saving files manually, but only when the plugin formats them. Interestingly when running this plugin while having the source file open, it does get saved correctly. – Broxzier Apr 26 '16 at 09:08
  • Still, it remains an encoding problem. Either one, the beautifier or the studio reads or writes the (obvious) multibyte character differently than the other expects. Encoding issues are the reason one normally should use ASCII characters only in source code - so you might possibly even think about replacing © with (C)... – Aconcagua Apr 26 '16 at 11:26