iphone - Objective C string encoding -


i seem having problem withs tring encoding.

i have following code:

// sets server url , whether or not server logged in - (server *) init:(nsstring *) url {   // setup singleton!  _instance = self;   // store our own copy of string  self.serverurl = [[nsstring alloc] initwithstring:url];  self.is_logged = no;  nslog(@"given: %s current: %s should be: %s", url, self.serverurl, @"http://clanware.com:8000/api");   return self; } 

`

the object instantiated follows:

self.server = [[server alloc] init:@"http://clanware.com:8000/api"]; nslog(@"url in server: %s", self.server.serverurl); 

i following output in gdb (i'm running in xcode)

[session started @ 2010-12-02 11:55:35 -0400.] 2010-12-02 11:55:40.388 projectprototype[1765:207] given: `üô» current: `üô» should be: `üô» 2010-12-02 11:55:40.390 projectprototype[1765:207] url in server: `üô» 

any appreciated, i'm lost , not sure do!

thanks alot =)

you shouldn't use %s on nslog nsstrings.
can print nsobject, including nsstrings, using %@ this:

nslog(@"given: %@ current: %@ should be: %@", url, self.serverurl, @"http://clanware.com:8000/api"); 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -