Probably a simple one to answer but need a bit of guidance. I have an agent that emails the contents of a form using rtitem.
when the email is received, apostrophes and speech marks display as “â”. Any idea how I can get the characters to display correctly?
Subject: Apostrophes & quotes display problem (email)
Did this just happen or it never worked?
Can you post the code that is doing this?
You do know that Notes 6.5 and 7.0 has not been supported in years.
Subject: RE: Apostrophes & quotes display problem (email)
Hi Barry,
Code below (some text hidden with *****)
Sub Initialize()
Dim session As New NotesSession
Dim db As NotesDatabase
Dim mailinview As NotesView
Dim newDoc As NotesDocument
Dim nextDoc As NotesDocument
Dim rtitem As NotesRichTextItem
Dim doc As NotesDocument
Dim maildoc As NotesDocument
Dim doccol As NotesDocumentCollection
Dim mailTo As String
Set db = session.CurrentDatabase
Set maildoc=New NotesDocument( db )
Set rtitem = New NotesRichTextItem( mailDoc, "Body" )
Set mailinview=db.GetView("TransfertoMail")
Dim recipients(1 To 2) As String
'recipients(1) = "****************"
'recipients(2) = "****************"
mailTo = "****************"
'maildoc.CopyTo=recipients
Set doc = mailinview.GetFirstDocument
While Not doc Is Nothing
Set nextDoc= doccol.getnextdocument(doc)
maildoc.Form = "Memo"
maildoc.Principal = "*******"
maildoc.Subject = "*********- " & doc.enquiryID(0)
Call rtitem.AddNewLine( 4 )
Call rtitem.AppendText( "Name - " + doc.FullName(0) )
Call rtitem.AddNewLine( 2 )
Call rtitem.AppendText( "Existing Customer? - " + doc.existingCustomer(0))
Call rtitem.AddNewLine( 2 )
Call rtitem.AppendText( "Person Type - " + doc.identity(0))
Call rtitem.AddNewLine( 2 )
Call rtitem.AppendText( "Mailing Reference - " + doc.MailingReferenceNo(0))
Call rtitem.AddNewLine( 2 )
Call rtitem.AppendText( "Enquiry Details - " + doc.enquiryDetails(0))
Call rtitem.AddNewLine( 2 )
Call rtitem.AppendText( "Date of enquiry - " + doc.submitDate(0))
Call rtitem.AddNewLine( 2 )
Call rtitem.AppendText( "Time of enquiry - " + doc.submitTime(0))
Call rtitem.AddNewLine( 2 )
Call rtitem.AppendText( "Contact Details")
Call rtitem.AddNewLine( 1 )
'Call rtitem.AppendText( "Address - " + doc.ContactAddress(0))
If doc.hwAddressPropertyName(0) <>"" Then
Call rtitem.AppendText(doc.hwAddressPropertyName(0))
End If
Call rtitem.AddNewLine( 1 )
Call rtitem.AppendText(doc.addressLine1(0) )
Call rtitem.AddNewLine( 1 )
If doc.addressLine2(0)<>"" Then
Call rtitem.AppendText(doc.addressLine2(0) )
Call rtitem.AddNewLine( 1 )
End If
Call rtitem.AppendText(doc.addressTown(0) )
Call rtitem.AddNewLine( 1 )
If doc.addressCounty(0)<>"" Then
Call rtitem.AppendText(doc.addressCounty(0) )
Call rtitem.AddNewLine( 1 )
End If
Call rtitem.AppendText( doc.ContactPCode(0) )
Call rtitem.AddNewLine( 2 )
Call rtitem.AppendText( "Daytime telephone number - " + doc.dayTimePhoneNumber(0) )
Call rtitem.AddNewLine( 2 )
Call rtitem.AppendText( "Evening telephone number - " + doc.eveningPhoneNumber(0) )
Call rtitem.AddNewLine( 2 )
mailDoc.SendTo=mailTo
mailDoc.CopyTo=recipients
Call mailDoc.Send(False)
doc.MailSent = "Yes"
doc.StatusClosed = "*********"
doc.StatusClosed_1 = "**********"
doc.StatusOpen = ""
doc.StatusOpen_1 = ""
doc.CurrentStatus = "Closed"
Call doc.Save(True,True)
Set doc= nextDoc
Wend
End Sub
Subject: Apostrophes & quotes display problem (email)
If you save of the doc you are sending does it look ok.
Trying to rule out router or other the users client. What field has issue with the special characters? Are the emails being adresses to internet addresses or notes addresses?
Subject: RE: Apostrophes & quotes display problem (email)
The field is enquiryDetails, which looks fine in the saved form on the database. This is just one of many fields that build up the email body. I’m running the agent myself and sending it to myself to test at the moment. This is a new agent that hasn’t worked yet, so this isn’t a new problem that’s occured on a previously working database.
Subject: RE: Apostrophes & quotes display problem (email)
do a save of maildoc into the current db and then view it in that db if you have a memo form or just copy the doc into a local blank mail file and make sure what you are sending looks good.
I take it based on your code enquiryDetails is a text field and not a richtext field.
As long as there are no rich text fields you can really build a long string in your code and set the maildoc.body field to that string.
Subject: Apostrophes & quotes display problem (email)
Are the emails going to recipients who use Notes within your organization? Or are they going to external recipients via SMTP?
-rich
Subject: RE: Apostrophes & quotes display problem (email)
Hi Rich,
It’s going to an internal notes account.
Subject: RE: Apostrophes & quotes display problem (email)
Did you save the doc like I suggested and look at it before it hits the router?
Subject: RE: Apostrophes & quotes display problem (email)
Thanks for your time. The charcters are being received into the database this way from another system. Not a notes problem.
Subject: RE: Apostrophes & quotes display problem (email)
So if you know for sure what you are sending is ok then the router is doing something. If you are ending it to a notes email address barryshapiro/org1/org@maildomain right vs barryshapiro@mydoman.com right?
Check what the mail prefrences are on the person doc. Is it keep in senders format or prefers rich text?
Subject: RE: Apostrophes & quotes display problem (email)
What is the other system? How is it sending the data? What do the characters look like if you save them in a plain text field instead of a rich text field?
It sounds like the data the other system is sending you is not encoding the data correctly. Lotusscript expects string data to be unicode.
-rich