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
1
vote
1 answer

How to represent NSString with '\336\362\340' value in appropriate encoding as normal text?

I got strings like this from audio stream as titles: Þòà - Ïàäàòü I know that this string in russian. And I need to show it correctly in UILabel. I try this: NSData *data = [value dataUsingEncoding:NSNonLossyASCIIStringEncoding]; NSString…
yas375
  • 3,940
  • 1
  • 24
  • 33
1
vote
2 answers

NSString to HEX

example: NSString *day = [[NSString stringWithFormat:@"السبت"];and i think the representation of this string in hex is this :%C7%E1%D3%C8%CA (windows-1256 encoding) what i want is how to convert arabic string to hex like this.
NouNou
  • 185
  • 4
  • 12
1
vote
1 answer

PerlObjCBridge Better way to read a plist from string (due to Incorrect NSStringEncoding value 0x0000 encoding error)?

This code snippet is an Example that should work on any Mac OS X system. #!/usr/bin/perl use Foundation; my $dscl = "/usr/bin/dscl"; sub getGeneratedUID(){ my $name = shift; my $command = "$dscl -plist . -read /Users/$name GeneratedUID"; …
acidprime
  • 279
  • 3
  • 18
1
vote
1 answer

How to convert c++ std::u32string to NSString?

I am developing a bridge between C++ and swift. And I need to convert C++ std::u32string to NSString. Here the code I tried: u32string str = U"some string"; NSLog(@"%@", [[NSString alloc] initWithBytes:str.data() length:str.size() * sizeof(char32_t)…
1
vote
1 answer

Swift String including Special Characters

I have a user enter a multi string in an NSTextView. var textViewString = textView.textStorage?.string Printing the string ( print(textViewString) ), I get a multi-line string, for example: hello this is line 1 and this is line 2 I want a swift…
Kenneth
  • 1,035
  • 1
  • 12
  • 26
1
vote
1 answer

NSString Decoding

I have a situation, I don't know what causing it. I have got a string from server like this NSString *str=@"\\u3060\\u3044\\u3053\\u3093\\u3001\\u5927\\u6839\\n"; I am trying to decode it using the following code.. NSLog(@"%@",[self…
iphonic
  • 12,615
  • 7
  • 60
  • 107
1
vote
1 answer

Wrapping a c++ code with Objective-C++

I am currently trying to use a piece of code I have written in c++ in an iphone application. I have read about wrapping C++ code using objective-C++. the c++ function I am trying to call takes for arguments 2 std::string and returns a…
1
vote
0 answers

Could there be any issues with doing a double NSUTF8StringEncoding on a NSString?

So I am making a POST call to my server with the following code: NSCharacterSet *set = [NSCharacterSet URLQueryAllowedCharacterSet]; NSString *POSTencoded = [POSTdata stringByAddingPercentEncodingWithAllowedCharacters:set]; NSData *postData =…
Ethan Allen
  • 14,425
  • 24
  • 101
  • 194
1
vote
1 answer

iOS: NSString(data: NSData, encoding: UInt) fails at some characters

I'm pulling an XML file over the network in my XML app. I know that the file should be encoded using ISO-8859-1. So I try to decode it when I pull it: func extractXMLFromHttpResponse(data: NSData) -> XMLIndexer { let xmlContent = NSString(data:…
productioncoder
  • 4,225
  • 2
  • 39
  • 65
1
vote
1 answer

iOS decode HTML entity to string

I have this code 台, it is actually a Chinese character with HTML escape using this site. I wanted to change from the mentioned code back to Chinese character in the program. I tried out NSString + HTML Link 1 and Link 2. With the method name…
IssacZH.
  • 1,457
  • 3
  • 24
  • 54
1
vote
3 answers

NSURL URLWithString returns nil

I am stuck in a very obvious method of NSURL class URLWithString I am passing a string and while creating URL it returns nil, my string is perfect. When ever I uses same string in browser then it is working fine. I am using following method to…
Syed Ali Salman
  • 2,894
  • 4
  • 33
  • 48
1
vote
2 answers

NSData encoding

Currently, I'm trying to parse an NSData in my iOS app. Problem is, I can't seem to find a proper hebrew encoding for parsing. I must decode the data using the Windows-1255 encoding (hebrew encoding type for windows) or ISO 8859-8 encoding, or I'll…
Lior Pollak
  • 3,362
  • 5
  • 27
  • 48
1
vote
0 answers

NSString init with data by encoding NSJapaneseEUCStringEncoding fails on IOS 8 simulator

I used to be able to convert EUC japanese data into NSString by using the following code. The expected result is "目標". But I just tried to use IOS 8 simulator and the result is null. const char bytes[]={0xcc, 0xdc, 0xc9, 0xb8}; NSData *d=[[NSData…
Chris
  • 11
  • 1
1
vote
2 answers

How to use stringWithContentsOfFile:usedEncoding:error:

I've tried to load a file with unknown encoding. This is because I dont always have control over the file that I will load. I assumed that the method stringWithContentsOfFile:usedEncoding:error: will do this and will let me know the file encoding.…
Lukasz 'Severiaan' Grela
  • 6,078
  • 7
  • 43
  • 79
1
vote
3 answers

How to generate random string in Objective-C based on core data values

I am developing one iOS application using storyboard and core data. For my application I need to generate one random string like 'M000142140502343524' which are not already exist in the 'data' field of the 'tableA' when click a button.
user3564078
  • 61
  • 1
  • 6
1 2
3
8 9