PowerTCP Mail for .NET
EncodingMap Property
Example 




Gets a Dictionary that is used to map an invalid ContentType.CharSet to a valid replacement System.Text.Encoding.
Syntax
Public Shared ReadOnly Property EncodingMap As Dictionary(Of String,Encoding)
Dim value As Dictionary(Of String,Encoding)
 
value = Part.EncodingMap
public static Dictionary<string,Encoding> EncodingMap {get;}
public: __property static Dictionary<string*,Encoding*>* get_EncodingMap();
public:
static property Dictionary<String^,Encoding^>^ EncodingMap {
   Dictionary<String^,Encoding^>^ get();
}
Remarks
If a decoded charset string doesn't map to a valid System.Text.Encoding.WebName, the charset is converted to lowercase with non-alphanumerics removed and mapped to these replacement Encodings. The default mapping is initialized as follows:

Use 'Part.EncodingMap.Add("invalid-charset", Encoding.GetEncoding(/*replacement name or codepage*/))' to map any charset value to a replacement encoding.

When developing applications which target .NET Core or frameworks with limited Encoding sets, references to additional assemblies may be required for the availability of all Encodings listed above. One such assembly is System.Text.Encoding.CodePages which can be installed from NuGet and registered with the code example below (must be called before any Dart class constructors for the Encodings listed above to be included by default).

Example
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance)
See Also

Reference

Part Class
Part Members


PowerTCP Mail for .NET Documentation Version 4.3
© 2018 Dart Communications. All Rights Reserved.
Send comments on this topic