I'm working on a good sized ecommerce application that deals with mostly imported (French) products. One problem I ran into was how to store all the special characters in my DB (MySQL), yet still be able to display them in HTML (for the administrative side) and in Flash (for the presentation side.) The solution I settled on was to store everything using HTML entities (using the HTMLSafe() method from CFLib - slightly modified for my needs) and to use an HTMLUnSafe() method in my Flash gateway component to turn those entites into UTF-8 characters, which Flash happily displays properly.
So my question is, where should I put these functions (HTMLSafe() and HTMLUnSafe()) so that I can access them easily, and yet not have to update a dozen components should I need to make a change? What I'm doing at the moment is adding them to my base DAO component, which all my other DAO's extend. There are already a few other 'utility' functions there (UploadFile() and QueryToArgumentCollection()) that I use often enough to want to have them available, but I do have another utility.cfc component that has more functions I use occasionally. Is there a best practice for placement of global (or group-specific) functions like these? Would it make sense to add my utility component to each data layer component that needs it? That seems wasteful. -- It's a metaphor for life itself. For that matter, everything in life is a metaphor for life. Except life. Life is probably a metaphor for metaphor. -- James Lileks ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
