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

126 questions
27
votes
6 answers

iOS 5: How to convert an Emoji to a unicode character?

I want to convert an Emoji to a unicode character in iOS 5. For example, converting to \ue415. I went to NSStringEncoding in NSString Class Reference. In iOS 4, NSUTF16BigEndianStringEncoding and NSUTF32BigEndianStringEncoding gave me and…
Protocole
  • 1,713
  • 9
  • 28
  • 41
24
votes
1 answer

Clang Error: Reference to NSUTF8StringEncoding is ambiguous

I am trying to create unit tests using the new XCTest framework introduced in Xcode 5. I have a line in one of my test cases that looks like this: XCTAssertEqual([self.client stringEncoding], NSUTF8StringEncoding, …); When I try to run my tests,…
wjk
  • 1,077
  • 7
  • 21
10
votes
3 answers

NSJSONSerialization serialization of a string containing forward slashes / and HTML is escaped incorrectly

I am trying to convert some simple HTML into a string value in a JSON object and I'm having trouble getting the string encoding to not escape the string in NSJSONSerialization. Example... I have a string which contains some basic HTML text: NSString…
JasonD
  • 7,202
  • 5
  • 28
  • 31
9
votes
8 answers

Binary to text in Java

I have a String with binary data in it (1110100) I want to get the text out so I can print it (1110100 would print "t"). I tried this, it is similar to what I used to transform my text to binary but it's not working at all: public static String…
Nick
  • 595
  • 3
  • 8
  • 26
6
votes
3 answers

How to remove the last unicode symbol from NSString

I have implemented a custom keyboard associated with a text field, so when the user presses the delete button, I remove the last character from the string, and manually update the current text field text. NSRange range =…
Bani Uppal
  • 854
  • 8
  • 16
5
votes
2 answers

Value of type 'Data?' has no member 'base64EncodedStringWithOptions'

Here I am encoding my string but it gives an error stated above. What I had done is: let plainData = (password)?.data(using: String.Encoding(rawValue: String.Encoding.utf8.rawValue)) let base64String =…
shahin ali agharia
  • 1,489
  • 3
  • 17
  • 35
5
votes
1 answer

stringWithUTF8String returning nil since iOS 8.2 update

I've been using stringWithUTF8String to convert my NSData to NSString as follows: if ([[NSString stringWithUTF8String:[responsedata bytes]] isEqualToString:@"SUCCESS"]){ dostuff... } It's been working fine; however, since the 8.2 iOS update,…
Stephan
  • 851
  • 6
  • 22
5
votes
1 answer

String length change after save in Core Data

So here is a problem. I have a string Белый Клык-0.fb2 NSString method length return 16 After save string in Core Data (backend - sqlite) NSString method length return 17, but visually string stay the same Белый Клык-0.fb2 And obviously…
Wert1go
  • 297
  • 5
  • 10
4
votes
1 answer

Special - Chinese characters in string

I am doing language translation in code. self.title.text = [NSString stringWithFormat:NSLocalizedString(@"Q%ld", nil), (long)quizNumber]; I have added localization which works fine in French case but in Chinese '%ld' comes on the screen. If I put…
4
votes
1 answer

Convert TXT File of Unknown Encoding to String

How can I convert Plain Text (.txt) files to a string if the encoding type is unknown? I'm working on a feature that would allow users to import txt files into my app. This means the file could have been created in any number of apps, utilizing any…
DenVog
  • 4,096
  • 3
  • 38
  • 66
4
votes
1 answer

how to omit \r\n after encoding string in base64encoding format?

I have a issue in omitting \r\n after encoding the string, below is the encoded string which I have got, QzAxODBCMDQtNDdDMi00QzhDLTg1MTAtNUE1MzU1RDIzRDA4Ojk4Mzg5MzRkYzky\r\nNTRkYWE4ODljY2Q0ZGYxNjljYTU
Santosh Gurram
  • 987
  • 3
  • 12
  • 22
3
votes
2 answers

Is there a way to "auto detect" the encoding of a resource when loading it using stringFromContentsOfURL?

Is there a way to "auto detect" the encoding of a resource when loading it using stringFromContentsOfURL? The current (non-depracated) method, + (id)stringWithContentsOfURL:(NSURL *)url encoding:(NSStringEncoding)enc error:(NSError **)error;, wants…
Moshe
  • 55,729
  • 73
  • 263
  • 420
3
votes
0 answers

Best way to handle emoji?

I have a textview that can contain multiple words and emoji's. However, I've noticed that some emoji's can crash my app How I'm currently handling emoji's: let data: NSData = myTextView.dataUsingEncoding(NSNonLossyASCIIStringEncoding)! let…
user5130344
3
votes
1 answer

Parsing and processing Text Strings in iOS

Wanted to find the best programming approach in iOS to manipulate and process text strings. Thanks! Would like to take a file with strings to manipulate the characters similar to the following: NQXB26JT1RKLP9VHarren Daggett B0BMAF00SSQ …
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…
1
2 3
8 9