Thanks for the replies. Yes, I would be replacing characters such as a dash with &mdash–but the website warns me not to use numbers such as «, which can cause formatting problems. That’s why he calls them named entities.
Rather than post a link, I’ll copy the relevant portion below–it’s a multi-part series with fairly long chunks of text in each part–a lot to read through. But if you want to see the series, a search for “Guido Henkel” and “ebook” will take you to it.
Thanks
The next step for us to do is to replace all special characters with their proper HTML entities. There is a very safe way to handle this in HTML that will properly display on every HTML device, regardless of font or text encoding. The key to success lies in HTML’s named entities.
If we take the ellipses (…), for example, in HTML there is a special code that tells the device to draw that particular character. It is called (&hellip); With this entity, the device knows to draw an ellipse that cannot be broken into parts and is treated as a single character.
If you use the entity (&mdash) the device will render a proper em dash. Proper length, proper size and all.
Next up are quotes. For that purpose, HTML offers (&ldquo) and (&rdquo) , entities that represent curly left and right double quotes. Correspondingly, (&lsquo) and (&rsquo) are the entities to draw curly single quotes.
If you happen to see something like this in your HTML code (¯) you know you’re asking for trouble, so make sure to use named entities only!
The brute force approach would be to search and replace all of them by hand, one entity at a time. This is not only time consuming but also prone to error, as you could all too easily overlook some in your text — but it may be the only option available to you.
The second — and easier way — is to automate the process. TextMate, the programming editor I am using, has a function called “Convert Selection to Entities excluding Tags” and it does exactly what we need. With it, it takes me one mouse-click to have all special characters in my entire book converted to named entities. Remember, using the right tools for the job will always make your life easier!