pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: Andrew Sykes <andrew.sykes@gmail.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: odd insert problem, textarea \n replaced with <br> gives
Date: Thu, 14 Oct 2004 09:48:56 +1300
Message-ID: <416D94B8.1020501@opencloud.com> (raw)
In-Reply-To: <7d68b7e304101311007923fb7f@mail.gmail.com>
References: <7d68b7e304101311007923fb7f@mail.gmail.com>

Andrew Sykes wrote:

> I've got a textarea in a JSP page, and I'm replacing the newline
> characters in the box with <br> using a regular expression. When I
> output the result of this to the page as a test, everything looks fine
> (i.e. <br>'s in the page source).

Is it possible that the replacement is actually not working, and 
something is translating ^M to <br> on page output? Perhaps try writing 
the string directly to a file or System.err to check?

> I pass this String to a method of a bean that does the inserting into
> the DB, and it appears to work fine; but when I use pgsql to check, I
> see that the <br> bit of the string has been replaced by a number of
> highlighted ^M characters.

I suspect that something between your code and the JDBC driver is not 
actually doing what you think it's doing. The driver knows nothing about 
HTML escapes or CR/LF in strings, it just passes them on to the backend.

-O



view thread (2+ messages)

Message-ID: <416D94B8.1020501@opencloud.com>
Permalink:  ../416D94B8.1020501@opencloud.com/
Also on:    postgresql.org/message-id/416D94B8.1020501@opencloud.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: oliver@opencloud.com, andrew.sykes@gmail.com
  Subject: Re: odd insert problem, textarea \n replaced with <br> gives
  In-Reply-To: <416D94B8.1020501@opencloud.com>
  References: <7d68b7e304101311007923fb7f@mail.gmail.com> <416D94B8.1020501@opencloud.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox