Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
Going via RTF is certainly one way around this problem.
Also the text file has to have a font that will display the charactes Something to bear in mind is that "plain text files" do not really have "a font". e.g. if you create some text in Word and use a particular font because that allows you to see a particular character, but when you save as plain text, no information about the font will be stored in the file. Word /might/ pick an encoding that has a chance of encoding all the characters that you used, but all you will end up with is a text file that has the character encoding that you specified or Word selected. It is possible that in some circumstances Progress decides to use a UTF-8 encoding. I have no way of knowing. However, since the macro I provided reads the file byte-by-byte, you can adapt it to discover how exactly TM is encoded in your text file. Also, there is nothing in that file that declares that the file uses this encoding or that encoding. So when a piece of software reads the file, it typically has to deduce the encoding purely from the content (and may perhaps use some settings - in Windows they would be in the registry - to guide it). In other words, the software has to guess. In many cases it may be impossible to decide between one encoding and another. IMO it is unfortunate that "plain text files" do not contain information about their encoding as standard. If the same text was included as a part in a MIME-format email, for example the encoding would almost certainly be provided in the part header. Peter Jamieson http://tips.pjmsn.me.uk On 31/10/2009 07:33, cocciastella wrote: 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! . |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Mail merge display results | Mailmerge | |||
mail merge currency symbols not working | Mailmerge | |||
display of no of pages after mail merge | Mailmerge | |||
How do i get job title information to display in mail merge? | Mailmerge | |||
Access to Word Mail Merge; symbols change to question marks | Mailmerge |