This documentation is archived and is not being maintained.
Encoding.BodyName Property
.NET Framework 1.1
Gets the name for this encoding that can be used with mail agent body tags.
[Visual Basic] Public Overridable ReadOnly Property BodyName As String [C#] public virtual string BodyName {get;} [C++] public: __property virtual String* get_BodyName(); [JScript] public function get BodyName() : String;
Property Value
The name for this encoding that can be used with mail agent body tags.
Remarks
For example, if this encoding is equivalent to UTF8Encoding, this property returns "utf-8".
If the encoding cannot be used, the property value is the empty string ("").
Example
[Visual Basic] Imports System Imports System.IO Imports System.Text Imports Microsoft.VisualBasic Namespace UTF7Example Public Class UTF7ExampleClass Public Shared Sub Main() Dim unicodeString As String = "This string contains the unicode character Pi(" & ChrW(&H03A0) & ")" ' Create a UTF7 encoding Dim utf7 As Encoding = Encoding.UTF7 ' Converting to UTF7 encodes characters so that they will pass through ' ASCII systems such as email. Dim utf7Writer As New StreamWriter("output.txt", False, utf7) utf7Writer.WriteLine(utf7.BodyName) utf7Writer.WriteLine(unicodeString) utf7Writer.Flush() utf7Writer.Close() End Sub End Class End Namespace [C#] using System; using System.IO; using System.Text; namespace UTF7Example { public class UTF7ExampleClass { public static void Main() { string unicodeString = "This string contains the unicode character Pi(\u03a0)"; // Create a UTF7 encoding Encoding utf7 = Encoding.UTF7; // Converting to UTF7 encodes characters so that they will pass through // ASCII systems such as email. StreamWriter utf7Writer = new StreamWriter("output.txt", false, utf7); utf7Writer.WriteLine(utf7.BodyName); utf7Writer.WriteLine(unicodeString); utf7Writer.Flush(); utf7Writer.Close(); } } } [C++] #using <mscorlib.dll> using namespace System; using namespace System::IO; using namespace System::Text; int main() { String* unicodeString = S"This string contains the unicode character Pi(\u03a0)"; // Create a UTF7 encoding Encoding * utf7 = Encoding::UTF7; // Converting to UTF7 encodes characters so that they will pass through // ASCII systems such as email. StreamWriter* utf7Writer = new StreamWriter(S"output.txt", false, utf7); utf7Writer -> WriteLine(utf7 -> BodyName); utf7Writer -> WriteLine(unicodeString); utf7Writer -> Flush(); utf7Writer -> Close(); }
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also
Show: