Re: Problems with Spanish Chars
| От | Tony Grant |
|---|---|
| Тема | Re: Problems with Spanish Chars |
| Дата | |
| Msg-id | 1058769571.1635.8.camel@vaio обсуждение исходный текст |
| Ответ на | Problems with Spanish Chars ("Pedro Galan" <pgalan@cscamaras.es>) |
| Список | 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
В списке pgsql-jdbc по дате отправления: