Re: insert with entity recognition

From: Robert Klemme <shortcutter_at_googlemail.com>
Date: Mon, 16 Aug 2010 23:17:00 +0200
Message-ID: <8cto6kF9r3U1_at_mid.individual.net>



On 16.08.2010 21:36, okey wrote:
> unicode database setup 10g
>
> &#0174 is a copyright symbol
>
> How can we make insert entity encode on the fly?, as in
>
> insert into product (title) values ('&#0174');
>
> We want the actual copyright symbol to show, not the&#0174.
> Inserting/updating from the application server is no problem, we
> entity encode there.

IMHO entity replacement should be made by some application way up closer to user input. If your DB is Unicode anyway then the entity accepting user input would be the proper location to convert this to Unicode text.   That makes your DB handling much more independent of input channels and you can even use it with several different input sources.

> (ps - we get the insert scripts like this)

What do you mean by this? Are you saying that you cannot get other input? If you can't the proper solution would be to do the conversion on the scripts, i.e. parse them replace those entity codes with Unicode characters and then feed the modified script into the DB. However, this is certainly more expensive than doing it elsewhere (see above) plus: how do you know that what you see is actually an entity or meant to be inserted into the DB as is?

Kind regards

        robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
Received on Mon Aug 16 2010 - 16:17:00 CDT

Original text of this message