pg.ddx.io pgsql-jdbc@postgresql.org mailing list archivehelp / color / mirror / Atom feed
odd insert problem, textarea \n replaced with <br> gives ^M ! 2+ messages / 2 participants [nested] [flat]
* odd insert problem, textarea \n replaced with <br> gives ^M ! @ 2004-10-13 18:00 Andrew Sykes <andrew.sykes@gmail.com> 2004-10-13 20:48 ` Re: odd insert problem, textarea \n replaced with <br> gives Oliver Jowett <oliver@opencloud.com> 0 siblings, 1 reply; 2+ messages in thread From: Andrew Sykes @ 2004-10-13 18:00 UTC (permalink / raw) To: pgsql-jdbc Hey there, I'm having a few issues with JDBC; i'm using the JDBC2 driver with Postgresql 7.3 on Gentoo. 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). 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. The database encoding is SQL_ASCII. Any idea what's going on? ^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: odd insert problem, textarea \n replaced with <br> gives 2004-10-13 18:00 odd insert problem, textarea \n replaced with <br> gives ^M ! Andrew Sykes <andrew.sykes@gmail.com> @ 2004-10-13 20:48 ` Oliver Jowett <oliver@opencloud.com> 0 siblings, 0 replies; 2+ messages in thread From: Oliver Jowett @ 2004-10-13 20:48 UTC (permalink / raw) To: Andrew Sykes <andrew.sykes@gmail.com>; +Cc: 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 ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2004-10-13 20:48 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2004-10-13 18:00 odd insert problem, textarea \n replaced with <br> gives ^M ! Andrew Sykes <andrew.sykes@gmail.com> 2004-10-13 20:48 ` Re: odd insert problem, textarea \n replaced with <br> gives Oliver Jowett <oliver@opencloud.com>
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