pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
insert problem with special characters
2+ messages / 2 participants
[nested] [flat]

* insert problem with special characters
@ 2003-05-13 17:18 jwang <john.wang@popmanager.com>
  2003-05-14 15:43 ` Re: [SQL] insert problem with special characters Randall Lucas <rlucas@tercent.net>
  0 siblings, 1 reply; 2+ messages in thread

From: jwang @ 2003-05-13 17:18 UTC (permalink / raw)
  To: pgsql-sql; +Cc: john.wang@popmanager.com <john.wang@popmanager.com>



Hi All,

I have a web application in JSP/Servlet/PostgreSQL(7.3). I have a text
input field where users can enter special cent symbol to represent cent
unit just like dollar symbol. So I have to use
java.net.URLDecoder.encode(text_input,"UTF-8") to fetch the request
input on the server. 

If I just insert the encoding text into the database, it will store the
text in URL-encoding format. But I want to store text in ASCII-readable
format (and cent symbol is stored just like dollar symbol), rather then
in URL-encoding format. If I am using
java.net.URLDecoder.decode(text_input,"UTF-8") to decode the text before
I do inserting, the cent symbol is stored as a question mark symbol in
database. I tried to find a postgres encoding function without success.
Does anyone know what the problem is and how to solve it?

Thanks a lot.

-John

GSP Marketing Technologies, Inc.
john.wang@popmanager.com




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [SQL] insert problem with special characters
  2003-05-13 17:18 insert problem with special characters jwang <john.wang@popmanager.com>
@ 2003-05-14 15:43 ` Randall Lucas <rlucas@tercent.net>
  0 siblings, 0 replies; 2+ messages in thread

From: Randall Lucas @ 2003-05-14 15:43 UTC (permalink / raw)
  To: jwang <john.wang@popmanager.com>; +Cc: pgsql-jdbc@postgresql.org; pgsql-sql


Hi John,
(added to JDBC list)

1. What is your database encoding?  Does it support the unicode OK?

2. Are you sure it's getting /stored/ as a question mark rather than 
just displayed as such?  Remember, if it is stored correctly, but you 
look at it from a terminal that doesn't support the character, you 
might be seeing an artifact of your terminal, not the underlying 
representation.

I would suggest you try having the cent symbol pulled in via the normal 
route, and once it's in a java.lang.String, have java pop open a 
JOptionPane.showMessageDialog and show you what it thinks the String 
is.  If it's not showing you the right character here, then the problem 
is way upstream of Postgres.  If it displays OK here, have Java pull 
the value back out of the database and show it in another 
messageDialog; my guess is you'll see one of three things:

A. Neither dialog shows the unicode OK.  This means you have some 
encoding/decoding issues upstream of Postgres.
B. The first dialog is OK, the second is not.  Probably, your encoding 
for the database is not set right.
C. Both dialogs are OK.  The problem is merely an artifact of how 
you're seeing the unicode stuff, not a Java + Postgres problem.

Best,

Randall


On Tuesday, May 13, 2003, at 01:18 PM, jwang wrote:

>
>
> Hi All,
>
> I have a web application in JSP/Servlet/PostgreSQL(7.3). I have a text
> input field where users can enter special cent symbol to represent cent
> unit just like dollar symbol. So I have to use
> java.net.URLDecoder.encode(text_input,"UTF-8") to fetch the request
> input on the server.
>
> If I just insert the encoding text into the database, it will store the
> text in URL-encoding format. But I want to store text in ASCII-readable
> format (and cent symbol is stored just like dollar symbol), rather then
> in URL-encoding format. If I am using
> java.net.URLDecoder.decode(text_input,"UTF-8") to decode the text 
> before
> I do inserting, the cent symbol is stored as a question mark symbol in
> database. I tried to find a postgres encoding function without success.
> Does anyone know what the problem is and how to solve it?
>
> Thanks a lot.
>
> -John
>
> GSP Marketing Technologies, Inc.
> john.wang@popmanager.com
>
>
> ---------------------------(end of 
> broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2003-05-14 15:43 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-05-13 17:18 insert problem with special characters jwang <john.wang@popmanager.com>
2003-05-14 15:43 ` Randall Lucas <rlucas@tercent.net>

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