Questions tagged [nsstringencoding]

Enumeration in Objective-C Cocoa API that contains type for string encoding

Enumeration in Objective-C Cocoa API that contains type for string encoding

127 questions
3
votes
1 answer

How to properly use NSPopUpButton

I have a NSPopUpButton that I want to use to select the text encoding for opening a file. I already have some ideas how to implement this, but as I'm starting to learn Objective-C and Cocoa I'm almost sure that there is a better way to accomplish…
2
votes
1 answer

How to fix string length encoding between 2 web clients?

I'm building an iOS app which among other things, sends data to a PHP server. I have problems with accented characters like in the string jeremyö which when sent from: iOS (using ASIHTTPRequest) is detected by PHP var_dump as string(7)…
jchatard
  • 1,881
  • 2
  • 20
  • 25
2
votes
1 answer

Can stringEncodingForData:encodingOptions:convertedString:usedLossyConversion: return NSUTF16StringEncoding or NSUTF32StringEncoding?

I'd like to know if calling stringEncodingForData:encodingOptions:convertedString:usedLossyConversion: can return NSUTF16StringEncoding, NSUTF32StringEncoding or any of their variants? The reason I'm asking is because of this documentation note on…
Cœur
  • 37,241
  • 25
  • 195
  • 267
2
votes
2 answers

URL Encoding a string with special characters

Please consider below code that I implemented in my iOS App: let kBaseURL = "https://www.sampledomain.com/" let method = "api/MasterData/GetCompanyList?jsonArgs={\"AccountID\":%d}" private func prepareURL(api: String) -> String { return…
Satyam
  • 15,493
  • 31
  • 131
  • 244
2
votes
1 answer

+ (instancetype) URLWithString returns nil when I try to put non-latin character

I know what's the error I've got however I don't know the way to decide it. It's okay to meet letters like Þþ, Ðð, Ææ, etc. within my Cocoa App. By breakpoints I'd put I found that URLWithString returns nil every time when I put at least one…
devshok
  • 737
  • 1
  • 8
  • 19
2
votes
2 answers

Swift encode & in the GET parameter

I have a simple GET request for login. Username is Silver and password is MOto&@10 I am using SwiftHttp framework for handling requests. On hitting login request, I always get response as false. However on hitting the login request url on browser…
Nitish
  • 13,845
  • 28
  • 135
  • 263
2
votes
1 answer

Get a 4 bytes hex string with stringWithFormat

Until now, I have this code : NSString *hex = [NSString stringWithFormat:@"%lX", crc32Result]; Which formats an int value into a hex (string) value. But now, I would like to always get a 4 bytes hex with "stringWithFormat". I mean, when the result…
fraxool
  • 3,199
  • 4
  • 31
  • 57
2
votes
1 answer

A string encoding issuse on IOS

I came across a problem with string encoding in ios development. The story is as below: I create some values in Chinese and then create a NSDictionary for those values, the dictionary is used as parameter for network request: -…
itenyh
  • 1,921
  • 2
  • 23
  • 38
2
votes
1 answer

NSString with Cyrillic to UTF8/Latin encoding

I have a string coming in from a web service, it's a mixture of Cyrillic and Latin/English characters. When building an array by separating the words in the sentence it show's the unicode in place of the letters when using NSLog. I want to know how…
skram
  • 5,314
  • 1
  • 22
  • 26
2
votes
1 answer

Function to detect the NSStringEncoding from NSURLResponse?

I just wanted to know if there is any existing category or any sort of function that will return me NSStringEncoding constant out of NSURLResponse object . The issue I am facing at the moment is as I have hardcoded the encoding to…
Bharat Jagtap
  • 1,692
  • 2
  • 22
  • 35
2
votes
1 answer

Dealing with special characters like (ö, Ä, é, ß) in iOS

I am fetching data from URL, and this data contains special characters, such as in the name Désirée. I want to display this in my TableView cell, but when I display it, it looks like this: Dösiröe. How do I make it display correctly? Fetch…
Krunal
  • 6,440
  • 21
  • 91
  • 155
2
votes
1 answer

NSString returning NULL while doing NSUTF8StringEncoding

Following is my code NSString *res = [valueArray valueForKey:@"key"]; NSData *newdata=[res dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES]; res=[[NSString alloc] initWithData:newdata…
2
votes
3 answers

Base64 issue in NSMutableURLRequest POST message?

I'm having communcation issues between my app and the server. I'm using RNCryptor to encrypt a message, which I then base64 encode and transfer to the server in the request. This is done in both the DATA header, and within the http body as post…
Tiago
  • 1,984
  • 1
  • 21
  • 43
2
votes
1 answer

iOS:detect correct encoding of NSData

I hava a NSData object which represents a NSString object. I use -[NSString initWithData:encoding:] to get the string. Now the problem is how do I know the correct encoding type? Thanks. Edited: I test and find: the supposing the NSData is encoding…
scorpiozj
  • 2,687
  • 5
  • 34
  • 60
1
vote
1 answer

iphone - display encoded characters like å,ä,ö in UILabel

I have a list that uses UILabel for each of its rows. If I try to display special characters such as å,ä,ö, it displays them as å ä ö How do I convert them into a UTF8 encoded NSString?
Suchi
  • 9,989
  • 23
  • 68
  • 112
1
2
3
8 9