Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » displaying chinese characters
displaying chinese characters [message #276976] Thu, 02 December 2004 09:52 Go to next message
Eclipse UserFriend
Originally posted by: jr102.yahoo.com

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. So this isn't the problem.

<%@ page language=3D"java"
contentType=3D"text/html;charset=3DUTF-8"%>

However the problem is, 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. Or if I need to do something to the O=
S.

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=3Dnull;
String scolb=3Dnull;
try {
Class.forName("oracle.jdbc.OracleDriver");
}
catch (ClassNotFoundException e) {
System.err.println (e) ;
System.exit (-1) ;
}
try {

// open connection to database
Connection connection =3D
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 =3D "SELECT cola,colb From abc"
;

// execute query
Statement statement =3D
connection.createStatement () ;
ResultSet rs =3D statement.executeQuery
(query) ;

System.out.println ("Executed query and
retrieving results...") ;
while ( rs.next () ){
scola=3Drs.getString("cola");
scola=3Dnew
String(scola.getBytes("Big5"));
System.out.println(scola);

//scolb=3Drs.getString("colb");
//scolb=3Dnew
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();
}
}
}


-- =

Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
Re: displaying chinese characters [message #276979 is a reply to message #276976] Thu, 02 December 2004 10:02 Go to previous message
Eclipse UserFriend
Originally posted by: chaves.inf.no.ufsc.spam.br

Darin Wright answered this question elsewhere:

"In 3.0.1 and earlier, the console encoding was not configurable. This has
been fixed in 3.1. Please see the following bug report:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=69815
"

Try with 3.1 M3. It should work.
Previous Topic:How to move the workspace on the network
Next Topic:In PDE Build, can we set the debuglevel attribute in calls to Ant's javac task
Goto Forum:
  


Current Time: Sun Jul 13 08:33:21 EDT 2025

Powered by FUDForum. Page generated in 0.04146 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top