Skip to main content

how to Add Chinese to a java swing

1 reply [Last post]
hantani
Offline
Joined: 2007-05-17

The problem is quite simple

I have a dataBase with 2 kinds of information:
chinese letters
pijin writing, that has european letters with some strange accents

When I try to display them in a JTextField, the accents of the pijin writing disapear and the chinese letters won't appear

Thanks for any help

Edit:

I found where I have the problem: when I get the String from the dataBase using the code that follows, I only get the ASCII code 63, wich means I got the ? that shows up afterwars. Using ASCII code I can print the Chinese caracter, but how can I extract it from the database?

public static String ObtenerPalabraCaracter(int i){
String palabra;
palabra = "error";
try {
Statement orden = conexion.createStatement();

ResultSet tabla = orden.executeQuery("SELECT * FROM CARACTERES Where ID = " + i );

tabla.next();
palabra = tabla.getString("Caracter");

} catch (SQLException se){
System.out.println("Error al obtener una palabra en caracteres chinos: " + se);
}

return palabra;
}

Message was edited by: hantani

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
neunerball
Offline
Joined: 2005-11-22

Maybe this URL will give you the information you are looking for: http://java.sun.com/docs/books/tutorial/i18n/index.html