Subject Re: [Firebird-Java] Re: UNICODE_FSS, internationalization issue
Author Blas Rodriguez Somoza
Hello

At 10/07/2003 10:35 +0000, Panagiotis Konstantinidis wrote:
> > You are right - as I wrote before, all SQL statements are converted
> > using defaul JVM encoding. All _parameters_ are converted
>correctly.
> > Please post your code with PreparedStatement to check if this is
>the case.
>
>Well JAVA default encoding is 8859_7 (as it should because my most
>web apps run in that character set).
>
>Now I have an internationalized web app which I want to run in UTF-
>8. So my HTML FORMS post data in UTF-8 and my servlets which write
>to the database set request character encoding to UTF-8. (that way
>servlets read parameters properly) My JDBC connection is also set to
>UNICODE_FSS and the database is created using character set
>UNICODE_FSS. That way when I call PreparedStatement.executeUpdate()
>the driver should not convert parameters to java default encoding
>but to JDBC encoding or at least the database encoding (in both
>cases UNICODE_FSS).
>
>Pseudocode of the servlet follows :
>
>doInsert {
> request.setCharacterEncoding("UTF-8");
>
> String newsCode = request.getParameter("newsCode");
> String newsTitle= request.getParameter("newsTitle");
> String newsText= request.getParameter("newsText");
>
> get a db connection with lc_ctype=UNICODE_FSS;

Can you explain with more detail how do you get the connection and set the
lc_type? It seems the only place where it can be a problem.

>
> String query = "INSERT INTO newsTab
>(newsCode,newsTitle,newsText) VALUES (?,?,?)";
>
> database.createPreparedStatement(query);
>
> ps.setString(1, newsCode);
> ps.setString(2, newsTitle);
> ps.setString(3, newsText);
>
> ps.executeUpdate();
> ......
> ......
> ......
>}

Regards
Blas Rodriguez Somoza