diff --git a/.nuget/NuGet.Config b/.nuget/NuGet.Config
new file mode 100644
index 0000000..67f8ea0
--- /dev/null
+++ b/.nuget/NuGet.Config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.nuget/NuGet.exe b/.nuget/NuGet.exe
new file mode 100644
index 0000000..8dd7e45
Binary files /dev/null and b/.nuget/NuGet.exe differ
diff --git a/.nuget/NuGet.targets b/.nuget/NuGet.targets
new file mode 100644
index 0000000..3f8c37b
--- /dev/null
+++ b/.nuget/NuGet.targets
@@ -0,0 +1,144 @@
+
+
+
+ $(MSBuildProjectDirectory)\..\
+
+
+ false
+
+
+ false
+
+
+ true
+
+
+ false
+
+
+
+
+
+
+
+
+
+
+ $([System.IO.Path]::Combine($(SolutionDir), ".nuget"))
+
+
+
+
+ $(SolutionDir).nuget
+
+
+
+ $(MSBuildProjectDirectory)\packages.$(MSBuildProjectName.Replace(' ', '_')).config
+ $(MSBuildProjectDirectory)\packages.$(MSBuildProjectName).config
+
+
+
+ $(MSBuildProjectDirectory)\packages.config
+ $(PackagesProjectConfig)
+
+
+
+
+ $(NuGetToolsPath)\NuGet.exe
+ @(PackageSource)
+
+ "$(NuGetExePath)"
+ mono --runtime=v4.0.30319 "$(NuGetExePath)"
+
+ $(TargetDir.Trim('\\'))
+
+ -RequireConsent
+ -NonInteractive
+
+ "$(SolutionDir) "
+ "$(SolutionDir)"
+
+
+ $(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir)
+ $(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols
+
+
+
+ RestorePackages;
+ $(BuildDependsOn);
+
+
+
+
+ $(BuildDependsOn);
+ BuildPackage;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ImapClient.cs b/ImapClient.cs
index f92baf4..393579f 100644
--- a/ImapClient.cs
+++ b/ImapClient.cs
@@ -21,6 +21,7 @@ namespace S22.Imap {
///
public class ImapClient : IImapClient
{
+ public static Encoding StreamEncoding = Encoding.ASCII;
Stream stream;
TcpClient client;
bool disposed;
@@ -516,7 +517,7 @@ string GetResponse(bool resolveLiterals = true) {
if (b == CarriageReturn)
continue;
if (b == Newline) {
- string s = Encoding.ASCII.GetString(mem.ToArray());
+ string s = StreamEncoding.GetString(mem.ToArray());
if (resolveLiterals) {
s = Regex.Replace(s, @"{(\d+)}$", m => {
return "\"" + GetData(Convert.ToInt32(m.Groups[1].Value)) +
@@ -551,7 +552,7 @@ string GetData(int byteCount) {
byteCount = byteCount - read;
}
}
- string s = Encoding.ASCII.GetString(mem.ToArray());
+ string s = StreamEncoding.GetString(mem.ToArray());
ts.TraceInformation("S -> " + s);
return s;
}
diff --git a/MessageBuilder.cs b/MessageBuilder.cs
index 31e367f..40d5bbb 100644
--- a/MessageBuilder.cs
+++ b/MessageBuilder.cs
@@ -170,7 +170,12 @@ static NameValueCollection ParseMIMEField(string field) {
} catch (FormatException) {
// If decoding fails, we should at least return the un-altered value.
}
- }
+ try {
+ coll[pname] = Util.DecodeWord(coll[pname]);
+ } catch (FormatException) {
+ // If decoding fails, we should at least return the un-altered value.
+ }
+ }
Match mvalue = Regex.Match(field, @"^\s*([^;]+)");
coll.Add("value", mvalue.Success ? mvalue.Groups[1].Value.Trim() : "");
} catch {
@@ -340,12 +345,12 @@ internal static void AddBodypart(this MailMessage message, Bodypart part, string
bytes = Util.Base64Decode(content);
break;
default:
- bytes = Encoding.ASCII.GetBytes(content);
+ bytes = ImapClient.StreamEncoding.GetBytes(content);
break;
}
} catch {
// If it's not a valid Base64 or quoted-printable encoded string just leave the data as is.
- bytes = Encoding.ASCII.GetBytes(content);
+ bytes = ImapClient.StreamEncoding.GetBytes(content);
}
// If the part has a name it most likely is an attachment and it should go into the
diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs
index 4462433..2aa798d 100644
--- a/Properties/AssemblyInfo.cs
+++ b/Properties/AssemblyInfo.cs
@@ -35,5 +35,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("3.6.0.0")]
-[assembly: AssemblyFileVersion("3.6.0.0")]
+[assembly: AssemblyVersion("3.6.0.50303")]
+[assembly: AssemblyFileVersion("3.6.0.50303")]
diff --git a/S22.Imap.csproj b/S22.Imap.csproj
index 77f6064..68e572a 100644
--- a/S22.Imap.csproj
+++ b/S22.Imap.csproj
@@ -115,6 +115,7 @@
+
diff --git a/S22.Imap.nuspec b/S22.Imap.nuspec
new file mode 100644
index 0000000..54526c5
--- /dev/null
+++ b/S22.Imap.nuspec
@@ -0,0 +1,16 @@
+
+
+
+ S22.Imap.PullReq-96
+ 3.6.0.50304
+ $title$
+ smiley22, just_dmitry
+ smiley22
+ http://opensource.org/licenses/MIT
+ https://github.com/justdmitry/S22.Imap
+ false
+ Clone of https://github.com/smiley22/S22.Imap with issue #47 fixed (pull request https://github.com/smiley22/S22.Imap/pull/96), also fixed decoding of =?utf-8?...= values in attachment header fields (content-type etc.)
+ Somewhere in startup put: ImapClient.StreamEncoding = Encoding.UTF8
+ Imap C# Library Component Mail Email fix
+
+
\ No newline at end of file
diff --git a/S22.Imap.sln b/S22.Imap.sln
index ed2386e..daa9f4f 100644
--- a/S22.Imap.sln
+++ b/S22.Imap.sln
@@ -1,6 +1,8 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2012
+# Visual Studio 2013
+VisualStudioVersion = 12.0.31101.0
+MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "S22.Imap", "S22.Imap.csproj", "{369C32A5-E099-4BD5-BBBF-51713947CA99}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{9F52283D-B191-4145-8EF0-B2C69D7A193E}"
@@ -8,6 +10,13 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj
{369C32A5-E099-4BD5-BBBF-51713947CA99} = {369C32A5-E099-4BD5-BBBF-51713947CA99}
EndProjectSection
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{B0067CF2-90B6-4A51-AEB9-5CD2D9DA351B}"
+ ProjectSection(SolutionItems) = preProject
+ .nuget\NuGet.Config = .nuget\NuGet.Config
+ .nuget\NuGet.exe = .nuget\NuGet.exe
+ .nuget\NuGet.targets = .nuget\NuGet.targets
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
diff --git a/Tests/MockStream.cs b/Tests/MockStream.cs
index 24347f6..19c14ef 100644
--- a/Tests/MockStream.cs
+++ b/Tests/MockStream.cs
@@ -12,7 +12,7 @@ internal class MockStream : MemoryStream {
///
/// A string to initialize the underlying
/// MemoryStream with.
- public MockStream(string mockText): base(Encoding.ASCII.GetBytes(mockText)) {
+ public MockStream(string mockText): base(ImapClient.StreamEncoding.GetBytes(mockText)) {
}
///