Re: dealing with accents in your databases (or to entity or not to entity...)

From: Date: Mon, 03 Feb 2003 17:09:20 +0000
Subject: Re: dealing with accents in your databases (or to entity or not to entity...)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-134146@lists.php.net to get a copy of this message
> --- "Ian M. Evans" <ianevans@digitalhit.com> wrote: > > How do you handle accented words and other problematic > > symbols on your database-driven sites? If you need to > > store one, do you store it as the actual character and > > display it with htmlentities, or do you store it as the > > html entity? > > Most people seem to prefer storing the data in its raw form > and translating it when you want to view it in HTML. This > can be very helpful if you are going to do something else > with the data (other than displaying it in a browser) or if > your formatting requirements are subject to change. > > However, it is ultimately up to you. If data is typically > viewed a few hundred times per single insert, it might be > worth the performance gain for you to format the data > before storing it. This way, when you get the data for > display, you don't have to perform any string functions. > > So, I guess you could say (this is a gross generalization, > but fairly accurate): > > Store data formatted => greater performance > Store data raw => greater flexibility > > Hope that helps. I agree. And 4.3 has a html_entity_decode() function that you can use to reverse your encode. So, store it in the format that it's going to be viewed in the most, then decode/encode for the exceptions. ---John Holmes...

« previous php.general (#134146) next »