8

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?

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
Zasz
  • 12,330
  • 9
  • 43
  • 63

2 Answers2

7

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.

Mike Mertsock
  • 11,825
  • 7
  • 42
  • 75
  • Perfect, this was the problem. And now its fixed! Thank you :) – Zasz Feb 10 '14 at 11:28
  • Seem like lots of issue with this feature. [This](http://stackoverflow.com/questions/17378065/page-uses-an-invalid-or-unsupported-form-of-compression-when-debugging-asp-net-m) and [this](http://stackoverflow.com/questions/17386555/garbage-tags-showing-up-in-mvc-views-after-installing-vs-2013-net-4-5-1). I had wasted quite some time tinkering with IIS, IISExpress, VS2010 aspnet_regiis random http modules , and was working with VS2012 until now. – Zasz Feb 10 '14 at 11:34
  • I have the same problem, but with VS2015, turning off browser link did not help, do you have any other suggestions? http://stackoverflow.com/questions/32665066/visual-studio-2015-wrong-asp-net-encoding – Amro Sep 19 '15 at 06:33
2

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

<configuration>
  <appSettings>
    <add key="vs:EnableBrowserLink" value="false" />
  </appSettings>
</configuration>
Daniel Liuzzi
  • 16,807
  • 8
  • 52
  • 57