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 :
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.
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.