iiley
05-03-2002, 06:56 PM
I know the text and String use Unicode in FlashMX,and,I know the String and char in java is Unicoded too!
but,i have a XMLSocket Server App builded by java,and the Client builded by FlashMX,the communicate correctly in English charaters,but wrong in Chinese charaters(16bit one character),in java window the charaters become some different wrong character.sand,we know that the Unicode support different Language charaters,but,where is my mistake?
the reader code in java like this:
in = new BufferedReader(
new InputStreamReader(
socket.getInputStream()));
......
char charBuffer[] = new char[1];
while(in.read(charBuffer,0,1) != -1 && this.ip==null) {
StringBuffer stringBuffer = new StringBuffer(256);
while(charBuffer[0] != '\0'){
stringBuffer.append(charBuffer[0]);
in.read(charBuffer, 0 ,1);
}
String tempStr=stringBuffer.toString();
System.out.println("the message is:"+tempStr);
}
.....
and the actionscripts like this:
......
MyMXLSocket.send(new XML(<TESTMSG>characters in Chinese</TESTMSG>));
but the java output is:
the message is:<TESTMSG>some different strange characters</TESTMSG>
oh~my god,i was puzzled!
hope you can understand my meaning with my poor English:(
thanx in advance!
but,i have a XMLSocket Server App builded by java,and the Client builded by FlashMX,the communicate correctly in English charaters,but wrong in Chinese charaters(16bit one character),in java window the charaters become some different wrong character.sand,we know that the Unicode support different Language charaters,but,where is my mistake?
the reader code in java like this:
in = new BufferedReader(
new InputStreamReader(
socket.getInputStream()));
......
char charBuffer[] = new char[1];
while(in.read(charBuffer,0,1) != -1 && this.ip==null) {
StringBuffer stringBuffer = new StringBuffer(256);
while(charBuffer[0] != '\0'){
stringBuffer.append(charBuffer[0]);
in.read(charBuffer, 0 ,1);
}
String tempStr=stringBuffer.toString();
System.out.println("the message is:"+tempStr);
}
.....
and the actionscripts like this:
......
MyMXLSocket.send(new XML(<TESTMSG>characters in Chinese</TESTMSG>));
but the java output is:
the message is:<TESTMSG>some different strange characters</TESTMSG>
oh~my god,i was puzzled!
hope you can understand my meaning with my poor English:(
thanx in advance!