Our db generates CSV files that we use as mail merge sources for both Word 2000 and Word 2007.
If I open these file with Notepad ALL of the characters are displayed correctly
If I open these file with Word (2000/2007) and tell Word the encoding is UTF-8 ALL of the characters are displayed correctly
BUT If I use the files as a mail merge data source the MM Wizard asks for the delimiter (comma) but NOT the encoding and then certain, 'exotic' e.g. accented, characters are NOT displayed correctly.
Is there away of getting Word to ask for the encoding of a MM data source?
Ken
using utf-8 .csv file as data source for Word mail merge
-
- Panoramic Lounger
- Posts: 8185
- Joined: 25 Jan 2010, 09:09
- Location: retirement
-
- Administrator
- Posts: 78582
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: using utf-8 .csv fiel as data source for Word mail merge
This is a tough problem. You might try placing a text file named schema.ini in the same folder as the .csv file, with contents like this
[filename.csv]
format=csvdelimited
colnameheader=true
characterset=65001
where filename.csv is the file name. colnameheader=true indicates that the first line of the file contains field names, and 65001 is the identifier for UTF-8.
[filename.csv]
format=csvdelimited
colnameheader=true
characterset=65001
where filename.csv is the file name. colnameheader=true indicates that the first line of the file contains field names, and 65001 is the identifier for UTF-8.
Best wishes,
Hans
Hans
-
- Panoramic Lounger
- Posts: 8185
- Joined: 25 Jan 2010, 09:09
- Location: retirement
Re: using utf-8 .csv fiel as data source for Word mail merge
Hmm, problem there is that the CSV files that come out of the db all have unique filenames so the schema.ini file would have to edited each time. Even so I'll have aplay around with this idea, thanks.
Meanwhile I have found a simpler workaround that I can easily show to the main users of these CSV files. If I open the file in Word, confirming the encoding as UTF-8, and then Save As .rtf , when I use the RTF file as the MM data source then all the characters are displayed correctly.
Ken
Meanwhile I have found a simpler workaround that I can easily show to the main users of these CSV files. If I open the file in Word, confirming the encoding as UTF-8, and then Save As .rtf , when I use the RTF file as the MM data source then all the characters are displayed correctly.
Ken
-
- Panoramic Lounger
- Posts: 8185
- Joined: 25 Jan 2010, 09:09
- Location: retirement
Re: using utf-8 .csv fiel as data source for Word mail merge
OK, tried that and no effect, at least not with Word 2007. A search for schema.in turns up a copy in my \Local Settings\Temp folder. the Contest of that file are:HansV wrote:This is a tough problem. You might try placing a text file named schema.ini in the same folder as the .csv file, with contents like this
[filename.csv]
format=csvdelimited
colnameheader=true
characterset=65001
where filename.csv is the file name. colnameheader=true indicates that the first line of the file contains field names, and 65001 is the identifier for UTF-8.
Code: Select all
[txt1F0.csv]
MaxScanRows=0
Format=Delimited(,)
ColNameHeader=True
Ken
-
- Administrator
- Posts: 78582
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: using utf-8 .csv file as data source for Word mail merge
The problem is that the text file converter used by Word "knows" about character sets, but the text file database driver used by mail merge doesn't. I don't know of a solution other than saving the csv file as an ANSI text file.
Best wishes,
Hans
Hans
-
- Panoramic Lounger
- Posts: 8185
- Joined: 25 Jan 2010, 09:09
- Location: retirement
Re: using utf-8 .csv file as data source for Word mail merge
Ah, so it's a feature, not an issue
-
- 2StarLounger
- Posts: 148
- Joined: 26 Dec 2010, 18:17
Re: using utf-8 .csv file as data source for Word mail merge
Just out of curiosity, when you merge from a .csv file, do you have the option to elect a database connection or DDE, so that it goes through Excel on its way to mail merge? Not sure whether that is possible or whether it would be helpful.
-
- Administrator
- Posts: 78582
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: using utf-8 .csv file as data source for Word mail merge
I don't get such an option in Word 2007, although I have "Confirm conversion at Open" turned on.
Best wishes,
Hans
Hans
-
- Panoramic Lounger
- Posts: 8185
- Joined: 25 Jan 2010, 09:09
- Location: retirement
Re: using utf-8 .csv file as data source for Word mail merge
I too have the 'Confirm conversion at Open' turned on (Word Options | Advanced |General | third tick box down).
When I 'select recipients', 'use existing list', browse to the folder holding the CSV and select it I get a 'Confirm Data Source' dialog. It only shows one option 'OLE DB database files' by default but if I tick the 'show all' tick box in the lower left corner of that dialog I'm offered all sorts of choices but there is no option that I can see that explicitly mentions either .csv or .txt file types.
I've not tried all of the possibilities (yet) but of the ones I have tried only the default OLE DB, recover text from any file *.* a,d Excel by DDE allow the mail-merge to connect to the file. However, in all cases the character encoding is misunderstood.
In other words, (so far) the workaround of first opening the .csv with Word, choosing UTF-* as the encoding, saving as .rtf and then mail-merging to the .rtf is the only safe route to a fix for my problem.
Ken
When I 'select recipients', 'use existing list', browse to the folder holding the CSV and select it I get a 'Confirm Data Source' dialog. It only shows one option 'OLE DB database files' by default but if I tick the 'show all' tick box in the lower left corner of that dialog I'm offered all sorts of choices but there is no option that I can see that explicitly mentions either .csv or .txt file types.
I've not tried all of the possibilities (yet) but of the ones I have tried only the default OLE DB, recover text from any file *.* a,d Excel by DDE allow the mail-merge to connect to the file. However, in all cases the character encoding is misunderstood.
In other words, (so far) the workaround of first opening the .csv with Word, choosing UTF-* as the encoding, saving as .rtf and then mail-merging to the .rtf is the only safe route to a fix for my problem.
Ken