Is there an equivalent to Objective-C JavaScript method for coding ()?

NSString *searchString = @"Lyngbø";
NSLog("%@",[searchString stringByAddingPercentEscapeUsingEncoding:NSUTF8StringEncoding]);

It gives me: Lyng% C3% B8

<script type="text/javascript">
document.write(escape("Lyngbø"));
</script> 

It gives me: Lyngb% F8

The search engine I'm developing with does not understand the Objective-C method of encoding a string and returns nothing when searching for words containing either æ. ø or å

+3
source share
1 answer

The difference between the sets. NSUTF8StringEncodingUse instead NSISOLatin1StringEncoding.

+6
source

Source: https://habr.com/ru/post/1787016/


All Articles