This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Journey To Enterprise Agility and have Daryl Kulak & Hong Li on-line!
See this thread for details.
Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Help to retrieve Chinese characters from MS Access  RSS feed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Ahmad Safri
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi..
Yes..I've installed chinese characters...and I've tried UTF-8 and UTF-16, but I keep getting ???
Thanks
 
Ranch Hand
Posts: 2545
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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, ...
 
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ahmad Safri
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 = "jdbcdbc: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 ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!