[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[eclipse-dev] Displaying Chinese Fonts
|
All,
I've tried searching for an answer to this but can't
seem to find it anywhere.
I have too support two client interfaces that both
need to support chinese data. One is an JSP that if I
set the content type in the jsp as follows it works
fine.
<%@ page language="java"
contentType="text/html;charset=UTF-8"%>
However, from a java application I can't get the
chinese characters to display properly in Eclipse
3.0.1 (I'm using the stable build on windows 2000 -
english version. Also I can display chinese characters
inside wordpad. etc. fine without any problems.) The
problem is when I run a test by clicking on Run Test
in eclipse. The output in the console is garbage. I
also tried changing the fonts for the console too and
nothing seemed to work.
Attached is my source code: If there is a
configuration issue I need to do on eclipse I would be
really appreciative if someone could assist me. I have
tried using UTF8, big5 and other encoding options but
nothing seems to work. Of if there is a program change
I need to do please let me know.
Any help would be appreciated. At this point I'm not
sure if its my code or eclipse configuration.
Thanks,
AJ
see attached code below;
class Test
{
public static void main (String s[])
{
String scola=null;
String scolb=null;
try {
Class.forName("oracle.jdbc.OracleDriver");
}
catch (ClassNotFoundException e) {
System.err.println (e) ;
System.exit (-1) ;
}
try {
// open connection to database
Connection connection =
DriverManager.getConnection(
"jdbc:oracle:thin:@localhost:1521:china",
"system", // ## fill in User here
"fuckme11" // ## fill in Password here
);
System.out.println("Got connection....");
// build query
String query = "SELECT cola,colb From abc"
;
// execute query
Statement statement =
connection.createStatement () ;
ResultSet rs = statement.executeQuery
(query) ;
System.out.println ("Executed query and
retrieving results...") ;
while ( rs.next () ){
scola=rs.getString("cola");
scola=new
String(scola.getBytes("Big5"));
System.out.println(scola);
//scolb=rs.getString("colb");
//scolb=new
String(scolb.getBytes("GBK"));
//System.out.println (scolb);
System.out.println (rs.getString
("colb"));
} connection.close () ;
}
catch (java.sql.SQLException e) {
System.err.println (e) ;
System.exit (-1) ;
}
catch(UnsupportedEncodingException uee) {
uee.printStackTrace();
}
}
}
__________________________________
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail