You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SR-3052 [Foundation] Incorrect result of string methods while working with non latin symbols
Issue Description:
Hello
I've noticed that `stringByAddingPercentEncodingWithAllowedCharacters` returns truncated result if the original string contains non-latin UTF characters. The result is encoded properly, but the last few symbols are missing, seems like a problem of calculating the length of resulting string
I'm having problems with Polish and Russian strings like: ''Łódź", "Москва" (I've added some digits on the ends of strings just for padding to see them disappearing in the resulting strings)
This reproduces on ubuntu15.10 and latest Swift development snapshot 2016-03-24. I've created a small example project demonstrating the issue here: https://github.com/kipelovets/SwiftUrlEncode
characters in input string is double byte characters, when encoded occupy 2 bytes. However, current implementation encodes string based on string length instead of encoded byte length of string. So, rest of the characters gets truncated depending upon no.of multibyte characters present in string.
Environment
ubuntu15.10
Additional Detail from JIRA
md5: ed86625d88e9266d98e1564e22c6c719
duplicates:
Issue Description:
Hello
I've noticed that `stringByAddingPercentEncodingWithAllowedCharacters` returns truncated result if the original string contains non-latin UTF characters. The result is encoded properly, but the last few symbols are missing, seems like a problem of calculating the length of resulting string
I'm having problems with Polish and Russian strings like: ''Łódź", "Москва" (I've added some digits on the ends of strings just for padding to see them disappearing in the resulting strings)
This reproduces on ubuntu15.10 and latest Swift development snapshot 2016-03-24. I've created a small example project demonstrating the issue here: https://github.com/kipelovets/SwiftUrlEncode
I also checked IBM sandbox and the issue reproduces on all available versions (3.0 Mar 1, 3.0 Feb 25, 2.2 Jan 11, 2.2 Jan 6). See the sandbox here: http://swiftlang.ng.bluemix.net/#/repl/3b7cd84828b080f7007ffbbb70db850e144aa3ab5e703433a7357a34f13609c3
The text was updated successfully, but these errors were encountered: