Browse Source

Fixed SD2-887: Converting VS 2003 project with special characters makes the project unusable

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1934 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
9ebcd55fb8
  1. 4
      src/Main/Base/Project/Src/Project/Solution/Solution.cs

4
src/Main/Base/Project/Src/Project/Solution/Solution.cs

@ -318,6 +318,7 @@ namespace ICSharpCode.SharpDevelop.Project
// we need to specify UTF8 because MsBuild needs the BOM // we need to specify UTF8 because MsBuild needs the BOM
using (StreamWriter sw = new StreamWriter(fileName, false, Encoding.UTF8)) { using (StreamWriter sw = new StreamWriter(fileName, false, Encoding.UTF8)) {
sw.WriteLine();
sw.WriteLine("Microsoft Visual Studio Solution File, Format Version 9.00"); sw.WriteLine("Microsoft Visual Studio Solution File, Format Version 9.00");
sw.WriteLine("# SharpDevelop " + RevisionClass.FullVersion); sw.WriteLine("# SharpDevelop " + RevisionClass.FullVersion);
sw.Write(projectSection.ToString()); sw.Write(projectSection.ToString());
@ -405,7 +406,8 @@ namespace ICSharpCode.SharpDevelop.Project
bool needsConversion = false; bool needsConversion = false;
using (StreamReader sr = File.OpenText(fileName)) { // read solution files using system encoding, but detect UTF8 if BOM is present
using (StreamReader sr = new StreamReader(fileName, Encoding.Default, true)) {
string line = GetFirstNonCommentLine(sr); string line = GetFirstNonCommentLine(sr);
Match match = versionPattern.Match(line); Match match = versionPattern.Match(line);
if (!match.Success) { if (!match.Success) {

Loading…
Cancel
Save