From: | Tony Grant <tony(at)tgds(dot)net> |
---|---|
To: | Pedro Galan <pgalan(at)cscamaras(dot)es> |
Cc: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: Problems with Spanish Chars |
Date: | 2003-07-21 06:39:32 |
Message-ID: | 1058769571.1635.8.camel@vaio |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
On Wed, 2003-07-16 at 10:37, Pedro Galan wrote:
> Hello,
>
> I'm trying to use PostgreSQL throught postgresjdbc driver from JSP's pages
> and I am having problems with Spanish special chars.
>
> If I try to insert a text containing any of the following chars á, é, í, ñ
> ... then the result is not correct. I supposse the driver transforms these
> chars into a '?' char.
>
> Any ideas ????
createdb -E LATIN1
for searching from JSP forms try escaping your input with this:
<%! public static String sqlEscape(String str) {
if(str==null) return(null);
StringBuffer strBuf = new StringBuffer();
for(int i=0; i<str.length();i++) {
char c = str.charAt(i);
if(c== '\'') {
strBuf.append(c);
strBuf.append(c);
} else {
strBuf.append(c);
}
}
return(strBuf.toString());
}
%>
And put sqlEscape around the accented text you want
(sqlEscape(request.getParameter("someTxt")) !=null)
Cheers
Tony Grant
From | Date | Subject | |
---|---|---|---|
Next Message | Arun Desai | 2003-07-21 10:04:56 | Number of function parameter |
Previous Message | peter mcgregor | 2003-07-21 04:39:07 | Calling a stored procedure with array parameters |