<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Sayed Ibrahim Hashimi - MSBuild, Web Deploy (MSDeploy), ASP.NET - bug</title>
    <link>http://sedodream.com/</link>
    <description>MSBuild, C#, Visual Studio and more</description>
    <language>en-us</language>
    <copyright>Sayed Ibrahim Hashimi</copyright>
    <lastBuildDate>Thu, 10 Jun 2010 03:24:01 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.3.9074.18820</generator>
    <managingEditor>sayed.hashimi@gmail.com</managingEditor>
    <webMaster>sayed.hashimi@gmail.com</webMaster>
    <item>
      <trackback:ping>http://sedodream.com/Trackback.aspx?guid=68b7ea19-35ad-4249-8106-b5c7e9299c3f</trackback:ping>
      <pingback:server>http://sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://sedodream.com/PermaLink,guid,68b7ea19-35ad-4249-8106-b5c7e9299c3f.aspx</pingback:target>
      <dc:creator>Ibrahim</dc:creator>
      <wfw:comment>http://sedodream.com/CommentView,guid,68b7ea19-35ad-4249-8106-b5c7e9299c3f.aspx</wfw:comment>
      <wfw:commentRss>http://sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=68b7ea19-35ad-4249-8106-b5c7e9299c3f</wfw:commentRss>
      <slash:comments>4</slash:comments>
      <title>Visual Studio file encoding issues: ∩╗┐</title>
      <guid isPermaLink="false">http://sedodream.com/PermaLink,guid,68b7ea19-35ad-4249-8106-b5c7e9299c3f.aspx</guid>
      <link>http://sedodream.com/2010/06/10/VisualStudioFileEncodingIssues.aspx</link>
      <pubDate>Thu, 10 Jun 2010 03:24:01 GMT</pubDate>
      <description>&lt;p&gt;
Have you ever executed a .cmd file (or .bat) file and received a message that looks
like the following at the top of your script (including image for compatibility) &lt;strong&gt;&lt;font size="4"&gt;∩╗┐&lt;a href="http://sedodream.com/content/binary/WindowsLiveWriter/VisualStudiofileencodingissues_1435C/image_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://sedodream.com/content/binary/WindowsLiveWriter/VisualStudiofileencodingissues_1435C/image_thumb.png" width="52" height="34" /&gt;&lt;/a&gt; &lt;/font&gt;&lt;/strong&gt;?
This was really annoying to me until I find out what was happening. I noticed that
Visual Studio (2010 at least, but I think previous version as well but not sure) was
changing the encoding of my .cmd files to be UTF-8! For example consider this simple
script (sample.cmd) that I created with &lt;a href="http://en.wikipedia.org/wiki/Notepad_%28Windows%29"&gt;Notepad&lt;/a&gt;.
&lt;/p&gt;
&lt;pre class="brush: plain;"&gt;echo 'hello world'&lt;/pre&gt;
&lt;p&gt;
When I execute this .cmd file from the command line the results are as shown below.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/WindowsLiveWriter/VisualStudiofileencodingissues_1435C/image_6.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://sedodream.com/content/binary/WindowsLiveWriter/VisualStudiofileencodingissues_1435C/image_thumb_2.png" width="465" height="35" /&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
What I did then was to simply create a copy of that file and placed that in a file
named sample-vs.cmd and then edited the script using Visual Studio 2010 to have the
contents below.
&lt;/p&gt;
&lt;pre class="brush: plain;"&gt;echo 'hello world from Visual Studio'&lt;/pre&gt;
&lt;p&gt;
When I execute that .cmd file to my surprise the results shown below are displayed.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/WindowsLiveWriter/VisualStudiofileencodingissues_1435C/image_8.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://sedodream.com/content/binary/WindowsLiveWriter/VisualStudiofileencodingissues_1435C/image_thumb_3.png" width="632" height="51" /&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
I was definitely not expecting that (&lt;em&gt;OK yeah I was because I created that script
for this blog post, but just go with it&lt;/em&gt;). I then opened the file in notepad and
it looked normal. So I edited it it notpad, saved it and the result was still the
same. The first line was not being processed correctly, it seemed. As I was editing
the file I noticed the encoding of the files were different. The encoding for the
sample.cmd file was set to ANSI and for sample-vs.cmd UTF-8. See for yourself from
the screen shots below.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/WindowsLiveWriter/VisualStudiofileencodingissues_1435C/image_10.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://sedodream.com/content/binary/WindowsLiveWriter/VisualStudiofileencodingissues_1435C/image_thumb_4.png" width="637" height="452" /&gt;&lt;/a&gt;&amp;#160;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/WindowsLiveWriter/VisualStudiofileencodingissues_1435C/image_12.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://sedodream.com/content/binary/WindowsLiveWriter/VisualStudiofileencodingissues_1435C/image_thumb_5.png" width="637" height="450" /&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
So I switched the setting for the sample-vs.cmd file to ANSI, executed the script
and all was good!
&lt;/p&gt;
&lt;p&gt;
I’m not sure why Visual Studio is changing the encoding for these files, but it looks
like a bug to me. I have logged a bug with Microsoft at &lt;a title="https://connect.microsoft.com/VisualStudio/feedback/details/566322/vs-2010-changs-encoding-of-cmd-file-to-utf-8" href="https://connect.microsoft.com/VisualStudio/feedback/details/566322/vs-2010-changs-encoding-of-cmd-file-to-utf-8.&amp;rsquo;m"&gt;https://connect.microsoft.com/VisualStudio/feedback/details/566322/vs-2010-changs-encoding-of-cmd-file-to-utf-8.&lt;/a&gt; The
bug may not be visible yet, but hopefully it will become public so that you can vote
on it if you have been bitten by this bug.
&lt;/p&gt;
&lt;p&gt;
Sayed Ibrahim Hashimi
&lt;/p&gt;</description>
      <comments>http://sedodream.com/CommentView,guid,68b7ea19-35ad-4249-8106-b5c7e9299c3f.aspx</comments>
      <category>batch-file</category>
      <category>bug</category>
      <category>cmd-file</category>
      <category>connect</category>
      <category>Visual Studio</category>
      <category>Visual Studio 2010</category>
    </item>
  </channel>
</rss>