B
Buddha
Dear All,
I am trying to make a very simple java program, where I am trying to
display Chinese characters. I am trying to save them into a file (for
now, later into db2). However, I seem to make no progress at all.
I am completely lost with this one. I have googled and gone through a
lot of sites like :
http://www.mandarintools.com/javaconverter.html
http://www.chinesecomputing.com/programming/java.html
http://forum.java.sun.com/thread.jspa?threadID=442220&messageID=1995079
http://www.linuxforum.net/chinese/develop/java.html
http://java.sun.com/docs/books/tutorial/i18n/locale/services.html
I have downloaded the cyberbit.ttf into /jre/lib/fonts and updated the
fonts.properties also. (I dont reallyknow if I need to do it though).
I have tried to compile with two different encoding options big5 and
gb2132 as well.
I have also tried to pick up a few unicodes from a site and tried ..
for ex.
String s = "\U+0061";
but this results in Illegale Escape Char. exception.
All I am trying to do is use a String reference, feed it with Chinese
text, which again I copied from a site, and then display it on the
console. Or even write it to a file.
I am lost in the maze of Unicode, UTF -8 etc.
Later on :
I tried to actually start working on the web app where this change is
intended.
I copied a chinese String from a website (pasted it in Word, and it
pasted fine).
Pasted it in the text box and saved this field. The value appears
gibberish in db2 ( I am sure the tables arent specified for UTF-8).
My app doesnt use any contentType or characterEncoding either.
Then when I retrieve this value, it comes as exact same gibberish as
in DB.
But, behold, when I change the encoding (view -> encoding -> chinese
(GB2312)) It displays the exact String that was inserted
Then I add these lines in my Jsp.
<%@ page contentType="text/html; charset=GB2312" %>
request.setCharacterEncoding("GB2312");
..
so that I can make that chinese GB2312 as the default option. It does
that. (The default was Western European (ISO).
However now, it displays question marks (????) in that field.
What options can I have ?
I would be really glad if someone could lead me out of this.
Thanks in advance.
Rgds,
This is a crosspost, obviously, because I did not recieve help
elsewhere.
I am trying to make a very simple java program, where I am trying to
display Chinese characters. I am trying to save them into a file (for
now, later into db2). However, I seem to make no progress at all.
I am completely lost with this one. I have googled and gone through a
lot of sites like :
http://www.mandarintools.com/javaconverter.html
http://www.chinesecomputing.com/programming/java.html
http://forum.java.sun.com/thread.jspa?threadID=442220&messageID=1995079
http://www.linuxforum.net/chinese/develop/java.html
http://java.sun.com/docs/books/tutorial/i18n/locale/services.html
I have downloaded the cyberbit.ttf into /jre/lib/fonts and updated the
fonts.properties also. (I dont reallyknow if I need to do it though).
I have tried to compile with two different encoding options big5 and
gb2132 as well.
I have also tried to pick up a few unicodes from a site and tried ..
for ex.
String s = "\U+0061";
but this results in Illegale Escape Char. exception.
All I am trying to do is use a String reference, feed it with Chinese
text, which again I copied from a site, and then display it on the
console. Or even write it to a file.
I am lost in the maze of Unicode, UTF -8 etc.
Later on :
I tried to actually start working on the web app where this change is
intended.
I copied a chinese String from a website (pasted it in Word, and it
pasted fine).
Pasted it in the text box and saved this field. The value appears
gibberish in db2 ( I am sure the tables arent specified for UTF-8).
My app doesnt use any contentType or characterEncoding either.
Then when I retrieve this value, it comes as exact same gibberish as
in DB.
But, behold, when I change the encoding (view -> encoding -> chinese
(GB2312)) It displays the exact String that was inserted
Then I add these lines in my Jsp.
<%@ page contentType="text/html; charset=GB2312" %>
request.setCharacterEncoding("GB2312");
..
so that I can make that chinese GB2312 as the default option. It does
that. (The default was Western European (ISO).
However now, it displays question marks (????) in that field.
What options can I have ?
I would be really glad if someone could lead me out of this.
Thanks in advance.
Rgds,
This is a crosspost, obviously, because I did not recieve help
elsewhere.