@Duncanma:To solve this kind of re-generation problems in the future (not just related to smileys, but also other situations where the HTML might need to be re-generated), you could make your code lazy: When a page wants to render a post, it gets the original text and the generated HTML from the database. If the HTML is empty, re-generate it and update the database record. When some new feature (or bug fix) requires the HTML of a lot of posts to be re-generated, you just "UPDATE Posts SET Html = NULL" and all the posts will be lazily re-populated (when they are requested).