Reflector的FileDisassembler插件输出结果为乱码的解决方案。
在Reflector中使用FileDisassembler插件,生成的文件中文有乱码,其实是因为编码的关系,修改之即可。附下载。
找到源码中FileDisassemblerHelper.cs里第 289 行开始。改为如下:
StreamWriter writer = null;
try
{
//修改如下行,改变为 UTF-8编码。原程序中没有编码设定
//writer = new StreamWriter(fileName);
writer = new StreamWriter(fileName,false,System.Text.Encoding.UTF8);
}
catch(NotSupportedException ex)
{
throw new ApplicationException(string.Format("Could not create file '{0}'", fileName), ex);
}
return writer;
try
{
//修改如下行,改变为 UTF-8编码。原程序中没有编码设定
//writer = new StreamWriter(fileName);
writer = new StreamWriter(fileName,false,System.Text.Encoding.UTF8);
}
catch(NotSupportedException ex)
{
throw new ApplicationException(string.Format("Could not create file '{0}'", fileName), ex);
}
return writer;
另外,注释掉AssemblyInfo.cs里的签名就可以编译了,为了以示区别,我还改了一下版本号,最后一位改为1.
[assembly: AssemblyVersion("5.0.42.1")]