String via getAttribute return with different encoding in iOS

Hello guys!

Appium 1.3.7
MacOSx 10.10.3 (Developer Preview)
Execution in an iPhone 4s with iOS 7.0.4
I don’t know if it’s relevant, but the app was developed in Swift.

The problem
A test that get an text by getAtrribute("valeu") return a different encoding

Expected (partial text): está
Actual: ele esta ́

Note that the acute is out of letter ‘a’
It cause an error when I try to assert the string via assertEquals

Does anyone faced of this situation?
Best regards!


I just had this same problem couple days ago and I finally got an way to solve it. So I’m digging this post for the others that may have same issue in the future.

For Python 2.7 I solve it using unicodedata.normalize(form, unistr). Your current language should have something similar to normalize().

Return the normal form form for the Unicode string unistr. Valid values for
form are ‘NFC’, ‘NFKC’, ‘NFD’, and ‘NFKD’.


 # python code
 # import normalize from unicodedata module
 from unicodedata import normalize
 # find your element as usual
 text_want_to_validate= driver.find_element_by_id(element_id)
 # now normalize your text
 n_text_want_to_validate = normalize('NFC', title.get_attribute('value')