string encoding over java bridge
string encoding over java bridge
- Subject: string encoding over java bridge
- From: Eric Blenkush <email@hidden>
- Date: Wed, 3 Nov 2004 20:45:47 -0800
Hi,
I have a NSString with a special character(a down arrow from
"Edit"->"Special Characters") which prints out fine using NSLog, but
when I pass it to a java object using the java bridge and print it out
it does not print out correctly. Also, when passed back to objective c
it does not print out correctly. The bridge does the NSString to
java.lang.String conversion automatically so I tried to get around it
using this code but I still have the same problem:
On the obj-c side:
//convert text to an NSData object
[textElement setData:[[self text]
dataUsingEncoding:NSUTF8StringEncoding]];
On the java side:
//use bytes from the NSData object to create a String assuming a UTF-8
encoding
public void setData(NSData d) throws Exception {
value = new String(d.bytes(0, d.length()), "UTF-8");
}
Any ideas?
Thanks,
Eric
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden