• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
string encoding over java bridge
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: string encoding over java bridge
      • From: Mike Hall <email@hidden>
References: 
 >Creating keyboard equivalents for NSScrollView? (From: Michael Heinz <email@hidden>)

  • Prev by Date: Re: How do I include a library in my program
  • Next by Date: Re: Recalculating an NSScrollView
  • Previous by thread: Creating keyboard equivalents for NSScrollView?
  • Next by thread: Re: string encoding over java bridge
  • Index(es):
    • Date
    • Thread