Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2013 produces garbled/corrupted/wrong-encoded html

I have a MVC4 Web project with Razor, which works fine in VS2012. In VS2013, after clean-rebuild, the same web project produce html with encoding issues. its looks like this. Lots of ��� (question mark characters in a dark diamond)

I am pretty sure its VS2013 that is the cause - I have tried re-installing IIS, recreating the websites, disabling gzip compression, disabling caching, deleting temporary compiled files etc etc etc... I am using VS2013 Pro Edition in Windows 8.1.

If I switch back to VS2012 and clean-rebuild the response is back to normal.

I have also tried the <globalization> element in project, and meta Content-Type and same with http headers, various combinations of content type values etc, to fix encoding in VS2013 - all to no effect.

Any solutions?

like image 534
Zasz Avatar asked Dec 20 '13 06:12

Zasz


2 Answers

Could be the Browser Link feature in VS 2013. Look for this in your toolbar:

Browser Link UI

Uncheck Enable Browser Link and reload the web page (rebuild shouldn't be necessary).

I figured this out noticing a bunch of requests like http://localhost:64667/613318d74fb54ab5bed269c36eb39fde/arterySignalR/connect... in Fiddler that I had never seen before. Also, using the Raw tab of the inspector in Fiddler showed lots of random unprintable bytes being injected into the HTML of my web pages.

like image 104
Mike Mertsock Avatar answered Oct 23 '22 21:10

Mike Mertsock


Browser Link can also be disabled via web.config, as follows:

<configuration>
  <appSettings>
    <add key="vs:EnableBrowserLink" value="false" />
  </appSettings>
</configuration>
like image 35
Daniel Liuzzi Avatar answered Oct 23 '22 23:10

Daniel Liuzzi