Skip to content

Instantly share code, notes, and snippets.

@dive
Created June 12, 2012 20:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dive/2920023 to your computer and use it in GitHub Desktop.
Save dive/2920023 to your computer and use it in GitHub Desktop.
iOS 5 cyrillic domain byg
NSString *string = [NSString stringWithUTF8String: @"http://президент.рф"];
NSURL *url = [NSURL URLWithString:[string stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
After this operations I check NSURL with:
[[UIApplication sharedApplication] canOpenURL:url]
canOpenURL return true. Then I open this NSURL at build-in browser Safari,
Safari told me that this page cannot be opened
(encoded URL seems like: http://xn--d1abbgf6aiiy.xn--p1ai),
after this I just press Refresh at browser without any additional actions
and Safari load URL fine, decode http://xn--d1abbgf6aiiy.xn--p1ai to http://президент.рф
and show me well-formed link.
@zgurya
Copy link

zgurya commented Aug 5, 2015

Hi!
Tell me, please, where it is inserted?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment