View Single Post
  #6   Report Post  
Posted to microsoft.public.word.mailmerge.fields
cocciastella cocciastella is offline
external usenet poster
 
Posts: 7
Default How do I get symbols to display in mail merge

Peter,

In discussions today we were thinking about using utf-8. Thank you for the
code so we can check it out, it's very helpful!!

The DB is Progress 8.3 and the code page is ico8859-1 which does not have
the TM, but in the UI the user can type Alt-0153 and it puts in a thick bar.
When I pull the data and write it to a text file the symbols are there. Also
the text file has to have a font that will display the charactes. I am using
Tahoma. There was a solution I found to save the text as an rtf and then
insert that into a word doc. Use the word doc as the datasourse. I cut out
the word doc and merge with the rtf file. I finally got that to work today
so I feel hopeful. I am not to great with the automation object in Progress.
On the SaveAs I can name the encoding and am using msoEncodingWestern and
word 2007 seems to like it.

Lonnie

"Peter Jamieson" wrote:

This could happen if Progress encodes the text file containing the TM
character using the Unicode UTF-8 encoding, but does not put a "Byte
Order Mark" (BOM) at the beginning of the file. (see
http://en.wikipedia.org/wiki/Byte-order_mark for further information on BOM)

In a UTF-8 file, the BOM consists of 3 octets ("bytes") with codes
239
187
191

You could use the following macro to see what is in the first three
bytes in /your/ file:

Sub show3octets()
' (no error checking yet)
Dim c1 As String * 1
Dim c2 As String * 1
Dim c3 As String * 1
' Put the pathname of your data source file here
Const strInputPath As String = "c:\myfiles\myinput.txt"

Open strInputPath For Binary As 1
Get 1, , c1
Get 1, , c2
Get 1, , c3
MsgBox "The first three characters are " & _
CStr(Asc(c1)) & ", " & _
CStr(Asc(c2)) & " and " & _
CStr(Asc(c3)) & "."
Close 1

End Sub

If there is no BOM, you could convert your file to a new file with a BOM
using the following code. However, you should only do this if the file
is definitely encoded as UTF-8 (sorry, I don't have code to check that
here!)

Sub insertBOM()
' (no error checking yet)
Dim c As String * 1
Dim c1 As String * 1
Dim c2 As String * 1
Dim c3 As String * 1
' Put the pathname of your input data file here
Const strInputPath As String = "c:\myfiles\myinput.txt"
' Put the pathname of your output data file here
Const strOutputPath As String = "c:\myfiles\myoutput.txt"

' Let's at least check that there is no BOM
Open strInputPath For Binary As 1
Get 1, , c1
Get 1, , c2
Get 1, , c3
If Asc(c1) = 239 And Asc(c2) = 187 And Asc(c3) = 191 Then
MsgBox "Already contains a Byte Order Mark?"
Else
Open strOutputPath For Binary As 2
c = Chr(239)
Put 2, , c
c = Chr(187)
Put 2, , c
c = Chr(191)
Put 2, , c
Put 2, , c1
Put 2, , c2
Put 2, , c3
Get 1, , c
While Not EOF(1)
Put 2, , c
Get 1, , c
Wend
Close 2
End If
Close 1

End Sub

It is possible that Progress is using some other encoding such as a
16-bit Unicode encoding, but judging from your experience so far it is
likely to be UTF-8.

That's about the best I can do without actually inspecting your data
source file.

Peter Jamieson

http://tips.pjmsn.me.uk

On 30/10/2009 05:08, cocciastella wrote:
How do I get symbols to display in mail merge.
The symbols are the copyright, registered tradmark and tradmark. They are
not in a specific place but could be anywhere. I have tried saving the txt
datasource to rtf format and then inserting into word doc so the datasource
is a word doc but the symbol is corrupted from the text to to the rtf. In the
text datasource it looks like:

"Report1","Subject1", ...
"xxReport","Itemxxx® description",... Which is correct.

I can't understand why word does not recognize these symbols. I get a
backwards
squiggly E. instead. I set the language to be English. Do I need to change
the code page? How is that be done?

Thank you

Thanks!




.