Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

Previous Next
Subject: mime AND japanese
Feedback Type: Problem
Product Area: Notes Client
Technical Area: Customization
Platform: Windows XP client
Release: 8.5.1
Reproducible: Always

the below code resides in an agent.
the agent when triggered will convert selected e-mails to mime files.
Code works well as long as the e-mails are 100% english. When you add some Japanese char to the e-mail the code bombs, giving the error of "Destination stream character set is incompatible with source"

What can one do to make this work no matter what language is there?


Dim ns As New NotesSession
Dim mimeDocCount As Integer
Dim strGetDUID As String

'On Error Goto HandleError

ns.ConvertMime = False

Set db = ns.CurrentDatabase

'This is where you need to change the URL to send to
strGetKey = "vKey"
Set profileView = db.GetView("LKProfile" )
Set profileDoc = profileView.GetDocumentByKey(strGetKey)

If Not (profileDoc Is Nothing) Then
strPushURL = Cstr(profileDoc.plURL(0))
Else
Messagebox("Unable to Locate Profile Doc, ask your Lotus Notes Administrator for Help!")
Exit Sub
End If

'Location of where files will be temporary stored
directory$ = jObject2.getUserDir()
Print "User DIR: " + directory$

'Start Hook on Selected Documents
Set dbCurrent = ns.CurrentDatabase
Set dcSelectedDocs = dbCurrent.UnprocessedDocuments
Set docExportDoc = dcSelectedDocs.GetFirstDocument()

strGetDUID = Cstr(docExportDoc.UniversalID)
'Count Selected Documents
mimeDocCount = 0
Set strmOutput = ns.CreateStream()

If (dcSelectedDocs Is Nothing) Then
Error 1000, {No Collection}
Elseif dcSelectedDocs.Count = 0 Then
Error 1001, {No documents selected}
End If

'Change strFileName to your preference.
strFileName = directory$ + "\" + docExportDoc.UniversalID + ".tmp"
Print "File Name: " + strFileName

Set MimeEntity = docExportDoc.GetMIMEEntity()
If Not strmOutput.Open(strFileName, MimeEntity.Charset) Then
Error 1002, { Cannot open file } + strFileName
End If

Do Until docExportDoc Is Nothing
Set MimeEntity = docExportDoc.GetMIMEEntity()

If (MimeEntity Is Nothing) Then
'No MIME on board.
Else
'We have MIME.
mimeDocCount = mimeDocCount + 1

Call GetMultipartMIME( MimeEntity, strmOutput, mimeDocCount, docExportDoc)
End If

Set docExportDoc = dcSelectedDocs.GetNextDocument( docExportDoc )
Loop

Call strmOutput.Close()


NormalExit:
ns.ConvertMime = True


'Delete File Created if Toggle = Yes
If(profileDoc.ToggleKillFile(0) = "Yes") Then
Kill (strFileName)
End If

Exit Sub

HandleError:
Dim strError$
strError$ = Error$ + Chr$( 13 ) + Chr$( 9 ) + "at " + Lsi_info( 2 )_
+ ":" + Cstr( Erl() )
Messagebox strError$, 0, "Error - #" + Cstr( Err() )
'Resume NormalExit
Exit Sub

Sub GetMultipartMIME(MimePart As NotesMimeEntity, Stream As NotesStream, passMimeDocCount As Integer, passDoc As NotesDocument )

'On Error Goto HandleError

Dim MimeChildEntity As NotesMimeEntity
Stream.WriteText(MimePart.BoundaryStart)

' Make sure binary elements are encoded properly
If (MimePart.ContentType <> "text") Then
Call MimePart.EncodeContent( ENC_BASE64 )
End If

Call MimePart.GetEntityAsText( Stream )
Set MimeChildEntity = MimePart.GetFirstChildEntity()

' If this part has any child parts, get them and all their descendants, too.
Do Until MimeChildEntity Is Nothing
Call GetMultipartMIME( MimeChildEntity, Stream, passMimeDocCount, docExportDoc)

Set MimeChildEntity = MimeChildEntity.GetNextSibling()
Loop

Stream.WriteText(MimePart.BoundaryEnd)

NormalExit:
Exit Sub

HandleError:
Dim strError$
strError$ = Error$ + Chr$( 13 ) + Chr$( 9 ) + "at " + Lsi_info( 2 )_
+ ":" + Cstr( Erl() )
Error Err(), strError$

End Sub


Feedback number WEBB7YHPEX created by ~Richard Quetponemaroni on 12/07/2009

Status: Open
Comments:

mime AND japanese (~Richard Quetpo... 7.Dec.09)
. . What line bombs? (~Sanjay Quettum... 7.Dec.09)
. . . . Call MimePart.GetEntityAsText( Stre... (~Richard Quetpo... 7.Dec.09)




Printer-friendly

Search this forum

Member Tools


RSS Feeds

 RSS feedsRSS
All forum posts RSS
All main topics RSS