Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

File Load Some bytes have been replaced with the Unicode substitution character while loading file

I was debugging in the .Net framework source code suddenly when I stepped into a file of theirs, visual studio 2010 raised this error:

File Load:
Some bytes have been replaced with the Unicode substitution character while loading file XXX, Saving the file will not preserve the original file contents.

when I click OK, the file is marked as unsaved, and when you try to save it, it says that the file is locked, but I can overwrite the file. I don't know what does this message means.

And why now, not the first time when visual studio downloaded the file from Symbol server?

like image 202
Nour Avatar asked Nov 29 '10 16:11

Nour


2 Answers

I started to get this error after switching on (for test purposes) the new setting "Beta: Use Unicode UTF-8 for worldwide language support" in the recent Windows 10 Spring 2018 update.

The message would then appear for every file that has non-ascii characters (German Umlauts mostly in my case) and had not been stored as UTF8 before.

Short-time fix: Revert the setting to not use UTF-8 as the "Current language for non-unicode programs", but use a language with the special characters that are used in the source files.

Long-time fix: Convert all your soure files to UTF-8.

like image 134
NineBerry Avatar answered Sep 18 '22 19:09

NineBerry


I fixed this issue by changing my "Language for non-Unicode programs" setting to "English (United States)". If you are using Windows 10, you can find it in "Control Panel -> Clock, Language, and Region -> Region -> Administrative".

Screenshot of the Region Settings dialog in Windows

like image 31
anzesheng Avatar answered Sep 20 '22 19:09

anzesheng