1

I try to get a value from a json file and restore it into an NSString but when the content contains apostrophe

e.g. de l'Achéron

i get this as result: de l’Achéron

I observed that this coding exists to json file too.

Can anyone tell me how to solve this?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
hoya21
  • 893
  • 7
  • 24

2 Answers2

1

You need review you server code if you can, because before put the l'Achéron in json you need set it as UTF-8 with an enconde function.

in PHP it is made with: $str_encoded=urlencode($str_utf8);

I hope that it helps.

hcarrasko
  • 2,320
  • 6
  • 33
  • 45
0

Cause server coding is not under my responsibility this worked and fixed my problem.

NSString *lala=textfromJSON;
lala=[lala stringByReplacingOccurrencesOfString:@"’" withString:@"'"];
hoya21
  • 893
  • 7
  • 24
  • That helps with _one_ Unicode character. There are a bit over a million of them. If the server code is produced by your company, then tell them that people think they are incompetent. If it's not done by your company, could you tell us which service it is so have a warning? – gnasher729 Mar 28 '14 at 21:48