Please help: Writing Chinese from Java 1.1 Applet to Server.

My applet has a chinese string such that:

String text = "\u5B57";

I am trying to get the Applet to post the Chinese String. By the time the String reaches the server it is already "?" - so I gather the encoding problem is occuring on the client (the applet). How do I ensure that this works ok?

My Source code:

DataOutputStream output = new DataOutputStream(connection.getOutputStream() );

// simulate a POST from a web form

String query = "id=" + ID;

query += "&";

query += "outtext=" + URLEncoder.encode(text);

// write out the data

int queryLength = query.length();

output.writeBytes( query );

output.close();

Thanks.

Best Regards,

Carlos

[750 byte] By [carlosnf] at [2007-9-26 4:29:41]
# 1

I could also use OutputStreamWriter but do i set encoding to "UTF-8" or "UTF-16" .... (also will someone tell me if there is a hyphen in the charset .. as in is it "UTF8" or "UTF-8"?

BufferedWriter output = new BufferedWriter(new OutputStreamWriter(connection.getOutputStream()),"UTF8");

// simulate a POST from a web form

String query = "id=" + ID;

query += "&";

query += "outtext=" + URLEncoder.encode(text);

// write out the data

int queryLength = query.length();

// output.writeBytes( query );

output.write( query, 0, query.length());

output.close();

TIA!

carlosnf at 2007-6-29 17:41:18 > top of Java-index,Desktop,I18N...
# 2
Thank you. I seem to have resolved this.
carlosnf at 2007-6-29 17:41:19 > top of Java-index,Desktop,I18N...