0

I am new to Cocoa development. I am using a .strings file to store Key and Value pairs. The value pairs contain some unicode characters like

"\u5f0a\u793e\u306e\u88fd\u54c1\u3092\u8a66\u3057\u3066\u307f\u308b\u3002"

Im using the below statements to parse the strings file

NSString *fname = [[NSBundle mainBundle] pathForResource:@"fileName" ofType:@"strings"];
NSString *fileText = [NSString stringWithContentsOfFile:fname encoding:NSUTF16StringEncoding error:nil];
NSDictionary *dict= [fileText propertyListFromStringsFileFormat];
NSLog(@"%@",[dict valueForKey:@"key"]);

I am getting ouput without '\' like

"u5f0au793eu306eu88fd"

But I want the output with '\' as exactly in the file.

Please help.

cacau
  • 3,606
  • 3
  • 21
  • 42
user3748791
  • 31
  • 1
  • 5
  • Could you provide an example of a more complete .strings file that you are using? – Yuchen Feb 23 '15 at 20:41
  • "home.general.products" = "\u5f0a\u793e\u306e\u88fd\u54c1\u3092\u8a66\u3057\u3066\u307f\u308b\u3002"; – user3748791 Feb 24 '15 at 01:39
  • Are you sure you have the encoding of your file right? Could you take a look at this one: http://stackoverflow.com/questions/7079930/how-to-change-text-encoding-of-localizable-strings-file-in-xcode-4 – Yuchen Feb 24 '15 at 01:50

0 Answers0