Re: Problem with accessing Russian UTF database

From: Alexander Panzhin <jalexoids(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Problem with accessing Russian UTF database
Date: 2008-11-27 00:51:20
Message-ID: 492DEF08.8000806@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi Ronald,

This is the JSP problem, since you need to set the correct
encoding on the JSP.
<%(at)page pageEncoding="UTF-8"%> - something like this should help.
I have a UTF8 coded database that handles multiple
scripts(Cyrillic, Latin and Georgian) and PostgeSQL has not in 5 years
shown a problem with any store/retrieve problems with UTF8 encoding. If
you have any problems, this discussion should probably be directed to
people that handle JSP and/or Java questions.

Ronald Vyhmeister wrote:
> Oliver and all,
>
> I see that there is a Java problem... I limited my code to this:
>
> <%@ page import="java.util.*" %>
> <%
>
> Locale locale = Locale.getDefault();
> locale = new Locale("ru", "RU");
> Locale.setDefault(locale);
> String someString = 'фывфывафыва';
> char[] rawCharacters = someString.toCharArray();
> for (int i = 0; i < rawCharacters.length; ++i)
> System.out.println("#" + i + " = " +
> Integer.toHexString((int)rawCharacters[i]));
> %>
>
> And tomcat cannot handle the string
>
> An error occurred at line: 2 in the jsp file: /iutus/unicode.jsp
> Invalid character constant
> 1: <%@ page import="java.util.*" %>
> 2: <%
> 3:
> 4: Locale locale = Locale.getDefault();
> 5: locale = new Locale("ru", "RU");
>
>
> If I replace the String statement with this:
>
> String someString = 'ф';
>
> The error changes to:
>
> Type mismatch: cannot convert from char to String
>
> So I thought I'd be smart and just define it as a char variable, but now it
> says:
>
> Invalid character constant
>
> So I've just done them one at a time for 5 characters:
>
> ф = f4
> ы = fb
> в = e2
> ц = f6
> л = eb
>
> It would appear to me that whatever I'm entering is NOT Unicode... so how do
> I force Windows/Linux/Mac to use Unicode for input/output? I'm trying to
> deal with an inherited app... and I'm no java guru...
>
> Ron
>
>
>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2008-11-29 07:46:36 Re: GSSAPI support [was: Re: New drivers released]
Previous Message Oliver Jowett 2008-11-26 12:03:27 Re: Problem with accessing Russian UTF database