From: | Mitch Pirtle <mitch(dot)pirtle(at)gmail(dot)com> |
---|---|
To: | "Schuhmacher, Bret" <Bret(dot)Schuhmacher(at)aspect(dot)com> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Ampersands in the output... |
Date: | 2005-01-13 00:50:29 |
Message-ID: | 330532b605011216502008beb4@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Hi Bret,
That sounds most likely served best at the application layer - for
example, if your application is written in PHP, you can use the PHP
function:
http://us3.php.net/htmlentities
You can also use regular expressions or PHP's str_replace to just
replace all instances of '&' with '&'.
Pretty sure other languages have their own methods as well.
-- Mitch
On Wed, 12 Jan 2005 16:22:41 -0800, Schuhmacher, Bret
<Bret(dot)Schuhmacher(at)aspect(dot)com> wrote:
> I'm using postgres to return business names via a function. In the
> function I "xml-ify" the output by taking the name and wrap it with
> start/end tags, as in "<name>name</name>" (there's a lot more to this
> and I'm simplifying greatly). However, the problem is that some of the
> names have "&" in them, like "Joes Bar & Grill", which really should be
> escaped in XML.
>
> Any ideas how to escape those things before they get to the recipient
> (i.e. my application, IE, Mozilla, etc.)? Is there a built-in function
> or something I could make use of? I suppose I could write a little more
> code in my function to look in the field and try to do a string replace
> or something, but is that the most efficient method?
>
> Thanks in advance! :-)
>
> Bret
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>
From | Date | Subject | |
---|---|---|---|
Next Message | Schuhmacher, Bret | 2005-01-13 01:27:30 | Re: Ampersands in the output... |
Previous Message | Schuhmacher, Bret | 2005-01-13 00:22:41 | Ampersands in the output... |