Re: odd insert problem, textarea \n replaced with <br> gives

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Andrew Sykes <andrew(dot)sykes(at)gmail(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: odd insert problem, textarea \n replaced with <br> gives
Date: 2004-10-13 20:48:56
Message-ID: 416D94B8.1020501@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2004-10-13 21:03:16 Re: FW: Question about the postgres resultset implementation
Previous Message Tornroth, Phill 2004-10-13 20:30:37 Re: FW: Question about the postgres resultset