If you’re importing a Word index into InDesign, chances are good that the index will import just fine. But what if you get the dreaded “index entries contain invalid characters” error? This happened to one of our readers recently. It’s a tricky issue to resolve since InDesign doesn’t specify which characters are invalid. With a Word index containing hundreds (or thousands!) of entries, how can you find the specific characters causing the issue?
Below I’ll explain the quickest and easiest way to resolve this issue. Here are the steps:
- Find invalid characters using Word and InDesign
- Fix the invalid characters in the index code in Word
- Import the Word index into InDesign
Find invalid characters using Word and InDesign
Narrow down your search
The trick to finding the invalid characters is to narrow down your search to a specific section of your Word document. Start by dividing your Word document in half—select the first half of the document, then copy and paste it into a new document and save it. Do the same with the second half of the document.
Now test both halves of the document in InDesign. Start a new document in InDesign by pressing Ctrl/Cmd+N, then click Create. (It doesn’t matter what specifications or trim size this new document has; it’s just for testing purposes.) Next, place the first half of your Word document in InDesign by pressing Ctrl/Cmd+D, choosing your file, then clicking Open.
When your cursor is loaded with text, hold Shift and click in the top left corner of the text frame. (Holding Shift will autoflow your text, and InDesign will create as many pages as needed to flow in the whole Word document.)
In the Pages panel, scroll down to the bottom and double-click on the last page. Then click the New Page icon to create a new page at the end of the document for your index.
Open the Index panel (Window>Type>Index). Click the Generate Index icon at the bottom, and … either your cursor will be loaded with text (yay! hold Shift and click in the top left corner of the text frame on your new page to autoflow the index), OR you’ll get the dreaded error message.
When you get the error message, you know that the section you’re working in has a problem. So divide that Word document in half again, and test both halves. Keep dividing the document that gets the error message until you have the error narrowed down to 8 or 10 pages.
Search the index in InDesign for invalid characters
Now you should have an 8- to 10-page document in InDesign that cannot generate an index. Where exactly is the problem? To find the invalid characters, you’ll search the Index panel for clues.
Start by expanding the letter A in the Index panel. You should see page icons with page numbers under each letter. If not, click the Update Preview icon at the bottom of the Index panel to generate the page numbers.
Now look at each index entry. Check the text to make sure the whole word or phrase is there. If a phrase is too long to display in the Index panel, hover your mouse over it and the phrase will appear in a pop-up box. When you check the words and phrases, you’re looking for any that are cut off, unfinished, or show curly quotes. When you check the page numbers, make sure they are proper page numbers and that none say PN.
Characters known to cause problems
Any index entries that contain a colon will cause problems. Why? Probably because colons are used in the Word index code to separate first and second level entries.
Curly quotation marks, including opening and closing quotes and apostrophes, will cause problems. Why? Probably because straight quotation marks are used in the Word index code to enclose the index word or phrase.
Other special characters that can cause problems may or may not include: @ # ! % ( ).
So look for all these things when you’re scanning your index for weirdness.
Does your Word index produce the error message Invalid Characters when you import it into InDesign? Here's how to fix it. http://tiny.cc/vz0m6y Share on XCopy text around a weird index entry to search for it in Word
When you find something strange about an index entry, click on the page icon below it, then click the Go to Selected Marker icon at the bottom left of the Index panel. This will take you to the entry in the InDesign document.
Make sure Show Hidden Characters is turned on by clicking Type > Show Hidden Characters (Ctrl/Cmd+Alt/Opt+I), and you’ll see a blue insertion point where the entry is coded.
Select some nearby text and copy it (Ctrl/Cmd+C). Then switch back to your original Word document (the whole one). Find that text by opening the Find feature (Ctrl/Cmd+F). Click inside the search box, paste the text you copied (Ctrl/Cmd+V), then Word will take you to that text.
Fix the invalid characters in the index code in Word
Now you should be in the spot in your original Word document where there is a problem with the index code. Make sure you can see hidden symbols by clicking the ¶ icon or pressing Ctrl/Cmd+Shift+8.
This is what healthy index code should look like:
{ XE:IndexFirstLevel:IndexSecondLevel “phrase” }
The index code begins with an opening curly bracket, followed by a space, then XE, then a colon. Next comes the first level index entry. Many index entries will only have one level, but for entries that have a second level (or sub entry), there is another colon separating the two entries. This is followed by a space, then the phrase enclosed in straight quotations (not curly!). Then one more space and a closing curly bracket.
Find the index code next to the text you searched for in your Word doc, and examine it carefully to make sure it complies exactly to the healthy code above. If there are any curly quotes or apostrophes in there, change them to straight ones (” or ‘). Figure out what is stopping the index entry from importing properly. If it looks healthy, but contains a special character (such as @ # ! %), then remove that character.
If you’re creating a new index entry and the word or phrase includes an invalid character, go ahead and create the entry as shown below, but be sure to remove the invalid character from the index code inside the curly brackets.
If an index code isn’t enclosed properly in the curly brackets (or the curly brackets don’t have those dotted lines around them), you may need to create a new entry and delete the incomplete one. To create a new index entry in Word, click the References tab. Select the text for your new entry, then click the Mark Entry icon. Make sure the new entry looks fine before deleting the old one.
When you’ve fixed all the index entries that looked weird, save your Word document and import it into InDesign.
Import the Word index into InDesign
Once again, you’ll need to start a new document in InDesign. Place your updated Word document, go to the last page, and create a new blank page at the end for the index as described above. Then … fingers crossed that the index generates without an error message!
Read more: Book back matter » Our suggested back matter elements can enhance your nonfiction book.
Read more: Calculate book page count using word count » Figure out how many pages your designed book will have using our formula or our InDesign template.
Book Design Made Simple. You can do it yourself.
Beth Corzo-Duchardt says
A regular dash (as in COVID-19) will also mess things up. This is quite a headache for me.
Fiona Raven says
Oh geez, thanks for letting us know!
Chris Thompson says
Thanks for the tips.
Another tip: it seems that a Word file with XE index tags AND floating text boxes will not import properly into InDesign.
Only the tags after the last text box import. Tested with Word 2016 Mac and ID CC 2015 and 2018. Removing the floating text boxes meant that all the XE tags imported OK.
Hope that helps anyone.
Regards,
Chris Thompson, Sep 2020.
Fiona Raven says
Thanks for the tip, Chris! That’s good to know, and I’m sure our readers will find it helpful.
Fiona