Forums Register Login

Help to retrieve Chinese characters from MS Access

+Pie Number of slices to send: Send
Hi all,
I really need your help. How do I retrieve chinese characters from MS Access 2000? I've been going through the forum..but can't really find one that can help me.
Thanks
+Pie Number of slices to send: Send
Hi safri,
Im not sure of this, but setting the character set to UTF-8 should work, or may b UTF-16???

Have u added the chinese font support for your OS?
+Pie Number of slices to send: Send
Hi..
Yes..I've installed chinese characters...and I've tried UTF-8 and UTF-16, but I keep getting ???
Thanks
+Pie Number of slices to send: Send
 

Originally posted by Safri:
Hi..
Yes..I've installed chinese characters...and I've tried UTF-8 and UTF-16, but I keep getting ???
Thanks


In my experience, to view Chinese characters, you have to have some Chinese viewing software installed, and run the program before you can read Chinese.
And also remember there are many kinds of Chinese characters out there: big5, GB, ...
+Pie Number of slices to send: Send
Link on adding Chinese fonts to the J2SE Platform.
Also Safri,
Welcome to JavaRanch,
we hope you’ll enjoy visiting as a regular however, your name is not in keeping with our naming policy
here at the ranch. Please change your display name to an appropriate name as shown in the policy.
You can change your profile here.
Thanks again and we hope to see you around the ranch!!
Cindy
+Pie Number of slices to send: Send
Hi all,
Thank you for all your replies. Here is my code...
**************************************************
import java.sql.*;
import java.io.*;
import java.util.*;
public class StreamConverter {
static void writeOutput(byte[] str) {
try {
FileOutputStream fos = new FileOutputStream("test.txt");
Writer out = new OutputStreamWriter(fos, "UTF-8");
fos.write(str);
} catch (IOException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {

try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}

catch (java.lang.ClassNotFoundException e)
{
System.out.println("Rosak - tak jumpa class(jdbc driver): " + e.getMessage());
}

// Open the datasource
try
{
Properties prop = new java.util.Properties();
prop.put("useUnicode", "true");
prop.put("characterEncoding", "UTF-8");

String url = "jdbc:odbc:cina";

Connection con = DriverManager.getConnection(url, prop);
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);

ResultSet rec = stmt.executeQuery ("SELECT * FROM Test");

while(rec.next()) {

String xx = new String(rec.getString("question"));
byte ucode[] = xx.getBytes("UTF-8");
System.out.println("This is byte ucode: "+ucode);
String Display = new String(ucode, "UTF-8");

writeOutput(ucode);
}

stmt.close();

} catch (SQLException s) {
System.out.println("Error s DBase --> " + s.toString() + " " + s.getErrorCode() + " " + s.getSQLState());

}catch (Exception e) {
System.out.println("Error e DBase -->" + e.toString() + e.getMessage());
}
}
}
**************************************************
Can anyone please.... tell me what's wrong with it....
I thank you in advance.
[ December 25, 2002: Message edited by: Ahmad Safri ]
We're being followed by intergalactic spies! Quick! Take this tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1743 times.
Similar Threads
Localisation in HTML
JDBC Driver that can extract Greek Characters from MsAccess
Appet with data Base
any chance to know the charset of a remote database?
How chinese characters are stored in MS notepad
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 19, 2024 02:54:41.