Examples: Charset property (NotesStream - LotusScript®)

This agent uses the file "CHARACTERS.TRK" with Turkish (ISO-8859-4) characters in it to create a message. To correctly display the message, your machine must be configured to display Unicode in Notes®.

Sub Initialize
  Dim session As New NotesSession
  Dim docT As NotesDocument
  Dim db As NotesDatabase
  Dim mimeT As NotesMIMEEntity
  Dim ss As NotesStream
  Dim mhdrT As NotesMIMEHeader
  fileName$ = "C:\StreamFiles\characters.TRK"
  chrset$ = "ISO-8859-4"
  
  session.ConvertMime = False
  Set ss = session.CreateStream
  Set db = session.CurrentDatabase
  Set docT = db.CreateDocument
  Call ss.Open( fileName$, chrset$ )
  Set mimeT = docT.CreateMIMEEntity
  If Not (mimeT Is Nothing) Then
    Call mimeT.SetContentFromText( ss, _
    "text/plain; charset="+chrset$, ENC_NONE )
    Call mimeT.EncodeContent( ENC_QUOTED_PRINTABLE )
    Set mhdrT = mimeT.CreateHeader("Subject")
    Call mhdrT.SetHeaderVal("Turkish Message")
    Call docT.ReplaceItemValue("From", "Main Topic")
    Messagebox mimeT.Charset,, "Charset"
    Call docT.Save( True, False )
  End If
  Call ss.Close
  session.ConvertMime = True
End Sub