Corrupted HTML when using Visual Studio
Guide
The solution to HTML being corrupted into broken Unicode when being passed down to the client.
Old Article
This content may be out of date or broken, please take care.Ever had this problem?
I just did, and it’s horrible! When I initially saw it, it was in such a niche part of our CMS that it looked more like a bug with our code rather than anything else. We spent a formidable amount of time as a team to try and solve the problem, yet everything from the Razor view to the data in SQL looked totally fine. The issue was prevalent in all browsers, and what made everything more bizarre was reverting to previous versions didn’t fix it, nor could it be replicated on other machines.
It has to be something wrong with my machine, right? So we began disabling all my browser extensions, and Visual Studio plugins… nothing. Perhaps it is IIS that is doing the deed? We reinstalled IIS express – nothing. We switched to local IIS and still, nothing! By this point it had fast approached home time and we weren’t getting anywhere.
So this morning I came to work, with gloom in my heart at the thought of having to tackle this problem all over. Sat at my desk, logged in, then did another quick google: “corrupted html visual studio”, I typed. Lo! A Stack Overflow Question!
Uncheck Enable Browser Link and reload the web page (rebuild shouldn't be necessary).
User esker exclaimed, so I tried it. Checked out the page again and a miracle! It works! Sometimes I question my sanity as a developer when stuff like this occurs, but then you sleep on it and the problems all go away. Hope this might help you poor stranger!