Dan, This sorts out your problem completely. htmlentities() will encode the data as it is inserted into the database and get_html_translation_table will help you translate it so it can be viewed in the browser. Have a look at the manual page for the get_html_translation_table function displayed below and you'll be sorted.
Steve PHP Manual Prev Next ---------------------------------------------------------------------------- ---- get_html_translation_table (PHP 4 >= 4.0b4) get_html_translation_table -- Returns the translation table used by htmlspecialchars() and htmlentities() Description string get_html_translation_table (int table [, int quote_style]) get_html_translation_table() will return the translation table that is used internally for htmlspecialchars() and htmlentities(). There are two new defines (HTML_ENTITIES, HTML_SPECIALCHARS) that allow you to specify the table you want. And as in the htmlspecialchars() and htmlentities() functions you can optionally specify the quote_style you are working with. The default is ENT_COMPAT mode. See the description of these modes in htmlspecialchars(). Example 1. Translation Table Example $trans = get_html_translation_table (HTML_ENTITIES); $str = "Hallo & <Frau> & Krämer"; $encoded = strtr ($str, $trans); The $encoded variable will now contain: "Hallo & <Frau> & Krämer". The cool thing is using array_flip() to change the direction of the translation. $trans = array_flip ($trans); $original = strtr ($str, $trans); The content of $original would be: "Hallo & <Frau> & Krämer". Note: This function was added in PHP 4.0. See also: htmlspecialchars(), htmlentities(), strtr(), and array_flip(). ---------------------------------------------------------------------------- ---- Prev Home Next explode Up get_meta_tags "Dan Christie" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > We are creating a content management system for a web site. In this app,I am > filling the contents of an html text area with the contents of a field in an > oracle database. This is our dynamic content for the site.The text area > allows the user to update its contents. For the time being, any characters > oracle considers illegal were to be entered by the client manually in their > ascii form. For instance, ' will be '. We thought this would be a short > term solution allowing the browser to see the characters correctly, and the > database to not error on the update. > The content can be saved to the database correctly, but when it is retrieved > there seems to be a conversion going on. I am seeing the character > interpreted as \' causing the next update on this field to fail. It is > strange because when I view the source, the html correctly keeps the ', > but when I use it in a php string and send it to the database, it seems to > be making a switch. > I need to keep this consistantly in its ascii representation, except when it > is viewed in a browser. > > Thanks, I'm desparate! > > Dan > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]