Visual Studio 2017 create new files with ansi encoding - visual-studio-2017

I'm using Visual Studio 2017.
When I create a new view when developing asp.net core MVC, the new file is saved with ANSI encoding. To solve it, I need to open the file in Notepad++ and then change the encoding to UTF8 with BOM.
Update:
Its only asp.net views that are created in ANSI, all other files like .cs are in utf8 by default.

Convert your ANSI files to UTF-8. I used notepad++ for that and symbols and accents render was fine then.
Also you can take a look at this post MVC .net core is not displaying special characters correctly

Related

How to MIGRATE ANSI/MBCS Resources for Visual Studio 2019 C++ MFC project

I have an old VS2008 based MFC project. We need to stick with ANSI/MBCS based characters - Wide Characters are not utilized.
However, it appears the Resource Editor .RC file output encoding is UNICODE (wide characters).
What is the proper procedure for MIGRATING ANSI based Resource Editor Resources (dialogs, strings, menus) from VS2008 TO Visual Studio 2019 C++ MFC Project, and be able to utilize the Resource EDITOR, not just the Resource COMPILER?

How to apply format when saving in Visual Studio 2022?

I have placed a .clang-format file in my project and can apply the formatting with Ctrl+K, Ctrl+D. I have also configured and enabled "Run Code Cleanup profile on Save" under Options -> Text Editor -> Code Cleanup. But when I save a file, the formatting is not applied.
Is there something I'm missing?
Thank you in advance!
Edit: Since it does not seem to be possible for C++ (as of June 2022), I will be using the extension Format on Save for VS2022 for now, which has a bit more functionality compared to Sedenion's suggestion.
You can use the free "Format document on Save" extension (github) to format C++ code via clang-format in Visual Studio 2022 on saving.
Side note, in case anyone else is reading this: In Visual Studio 2017 and 2019 you can also use the Microsoft extension "Power Commands for Visual Studio" for this purpose.
Unfortunately, Code Cleanup only applies to C# and VB.Net, and not to C++ code.
From MS documentation
For C# code, you can also configure Visual Studio to apply these code style preferences using the Code Cleanup

Problem displaying Hebrew characters in VS debugger with char/CString

I am having trouble with displaying Hebrew characters in Visual Studio.
In my app, they are printed right and well, but in Visual Studio while debugging, I get this:
I have to mention that I am using codepage 1255, I can't use Unicode because my source is big and it would take years to convert.

How to make CMake-generated Visual Studio projects capitalize the files properly?

I'm generating a Visual Studio 2015 C++ project with CMake. Everything works fine, except that all filenames are switched to lowercase. The filenames generated by CMake globbing are properly capitalized, but when opening the resulting project in Visual Studio (or with an editor), I can see that all filenames are suddenly lowercase (even though the paths themselves are properly capitalized).
With the C++/CLI project in the same solution, it works flawlessly.
Normally, I would only see it as a minor annoyance, but saving these files through Visual Studio changes the filename on disk and, by extension, in the repository.
Any ideas?

C++ copy formatted code to word (like Visual assist's)

I've browsed but could not find an answer..
I'm trying to copy code from my editor to look like the VA coloring, but it only copies like the VS coloring..
(Another great option would be to somehow do it like StackOverflow formats, but I could not find how to do that as well)
I've found:
http://www.wholetomato.com/products/features/rtf.asp
But it does not show where it is, nor can I find it (VS 2010)..
Does anyone know how to do it?
Or does anyone has an idea on how to copy formatted code to word?
Thanks!
A quote from the page you linked to:
Microsoft Visual Studio
Copying HTML to the clipboard is a built-in feature of Microsoft Visual
Studio and Visual Assist X does not enhance the feature. The
clipboard contains only the default colors of the IDE. Enhanced syntax
colors are not placed in the clipboard.
So it seems like what you want cannot be done.
If your ultimate goal is to make a final pdf, you can convert text file to pdf and combine your code pdf to your word pdf. You can try notepad++ for your default coloring your code.
Sorry but,
Microsoft Visual Studio
Copying HTML to the clipboard is a built-in feature of Microsoft Visual Studio and Visual
Assist X does not enhance the feature. The clipboard contains only the default colors of
the IDE. Enhanced syntax colors are not placed in the clipboard.
The feature you've meant was available only at Visual C++ 6.0.
VC++ 6.0 has no embedded ability to copy formatted code so they made their own realization of this feature in their plugin.
If you want just have VAssistX colored pdf you can try to print document in Visual Studio using any pdf printer such as PDFCreator then you can import it in Word (at least in LibreOffice Writer).