Convert character encoding of a CSV file for InDesign Data Merge

InDesign’s Data Merge feature is great. This is a video I return to, when I need to use it.

There is a catch, though: the data must be in the right format for this to work with Swedish text, which has å, ä and ö.

  1. Use a spreadsheet app to make a dataset (columns and rows)
  2. Use column names without spaces, and only lower-case characters. Do not use any “special characters”. So: only between a-z.
  3. Export it to CSV format
  4. Open the Terminal app in your Mac
  5. Change to your directory where the file is by dragging its folder into the Terminal window and hit ENTER.
  6. Type the following text command and press ENTER to change the file filen.csv to the target format (which is called utf-16):
    iconv -f utf-8 -t utf-16 < filen.csv > filen2.csv
  7. A new file filen2.csv is created in the same directory.
  8. Use this new file in your InDesign data merge!

Nerd notes:

  • Typing man iconv will bring up a text manual for the iconv command. Try it! (Quit the manual by typing q.)
  • the < and > are “output redirection” symbols, used in two directions in this so-called pipeline

The manual taught us that the command can be expressed as:

iconv --from-code utf-8 --to-code utf-16 < filen.csv > filen2.csv

This may be easier to read.

  • Changing directory can be done using the text command cd (“change directory”), followed by the path you want to navigate to.
  • pwd is a text command that reads “print working directory”. Try it!

4 Replies to “Convert character encoding of a CSV file for InDesign Data Merge”

  1. My Terminal skills sucks. I got an error. But I did manage to open it in Text Wrangler and save it out as utf-16. Worked like a charm!

  2. Thank you for the hint regarding file encoding for InDesign’s data merge feature!
    I have struggled with files I created using UTF-8 encoding, now I see that UTF-16 does the right job.

Leave a Reply

Your email address will not be published. Required fields are marked *