You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Kotsari Aspasia <sa...@copelouzos.com.gr> on 2001/06/01 11:06:23 UTC

Greek encoding in Java Servlet Output

Hi all!

I am facing the following problem:

I have made a Java servlet that reads HTML form data and sends it to an 
e-mail address.
When the data is in Latin characters (ISO-8859-1, I assume) the output is 
ok.
However, when the form data is in Greek it appears as "???????" in the 
e-mail.

I know it's a problem of Internationalization and bytes.

I have tried both PrintStream and PrintWriter, and also ISO-8859-7 and 
Cp1253 for the encoding, as well as other modified Writer classes, but no 
result.

Does anyone have any idea on how to get rid of those fussy questionmarks 
that are giving me quite a headache?

Thanx a lot! :)

Sassa.-


Re: Greek encoding in Java Servlet Output

Posted by Frank Morton <fm...@base2inc.com>.
Is your "out" in the example below a ServletOutputStream or
a PrintWriter?

> We are experiencing similar problems. We are using an Oracle database in
the
> UTF8 charset and were accessing thru JDBC thin with nlscharset classes.
>
>     DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
>     connection =
>
DriverManager.getConnection("jdbc:oracle:thin:@server:1521:TEST",username,pa
> sswd);
>
> However we had problems with various characters so we changed to the thick
> driver
>
>     Enumeration e = DriverManager.getDrivers();
>     Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
>     Connection connection =
> DriverManager.getConnection("jdbc:odbc:TPSO",username,passwd);
>
> and also added the following lines in the servlet.
>
>   response.setContentType("text/html;charset=UTF-8");
>   out.println("<meta http-equiv=\"Content-Type\"
> content=\"text/html;charset=UTF-8\">");
>
> This is however only tested for IE5.5.
>
>
> Ian
>


Re: Greek encoding in Java Servlet Output

Posted by Ian Goodchild <Ia...@diverseylever.com>.
Hi Sassa

We are experiencing similar problems. We are using an Oracle database in the
UTF8 charset and were accessing thru JDBC thin with nlscharset classes.

    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    connection =
DriverManager.getConnection("jdbc:oracle:thin:@server:1521:TEST",username,pa
sswd);

However we had problems with various characters so we changed to the thick
driver

    Enumeration e = DriverManager.getDrivers();
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection connection =
DriverManager.getConnection("jdbc:odbc:TPSO",username,passwd);

and also added the following lines in the servlet.

  response.setContentType("text/html;charset=UTF-8");
  out.println("<meta http-equiv=\"Content-Type\"
content=\"text/html;charset=UTF-8\">");

This is however only tested for IE5.5.


Ian