Why is it direct commented Encoded string not converting to Arabic?

arabic, ios, latin1, utf-8

Solution

The encode is in ANSI i think change it to UTF-8 from any tool. Use Notepad++ to apply for example and then you can use encode it within sqlite or ios.

Problem

``` NSString * string = @"االْحَمْدُ لِلَّهِ رَبِّ الْعَالَمِينَ"; const char *c = [string cStringUsingEncoding:NSUTF8StringEncoding]; NSString *newString = [[NSString alloc]initWithCString:c encoding:NSISOLatin1StringEncoding]; NSLog(@"%@",newString); // NSString * staticEncodedString = @"اÙÙØ­ÙÙ ÙØ¯Ù ÙÙÙÙÙÙÙ Ø±ÙØ¨Ù٠اÙÙØ¹ÙاÙÙÙ ÙÙÙÙ"; const char *cvvv = [newString cStringUsingEncoding:NSISOLatin1StringEncoding]; NSString *newStringV = [[NSString alloc]initWithCString:cvvv encoding:NSUTF8StringEncoding]; NSLog(@"%@",newStringV); ``` Why is it direct commented Encoded string not converting to Arabic? When i hardcode the Arabic it encodes and then decodes correctly, but why can't static encoded string not readable in arabic? Thanks for your reply Jake. Yes I loose data while decoding the "staticEncodedString".But All I want is to decode the following string back to Arabic. ``` NSString * staticEncodedString = @"اÙÙØ­ÙÙ ÙØ¯Ù ÙÙÙÙÙÙÙ Ø±ÙØ¨Ù٠اÙÙØ¹ÙاÙÙÙ ÙÙÙÙ"; ```

Original source