Encoding issue on iOS


I’m having an encoding issue using appium 1.5 and nodejs webdriver on iOS (simulator, ios 8).
The app contains following french text “News Cinéma”, and I’m using an xpath expression to find this element:
(//*[@name="News Cinéma"])[1]

Appium tells me that there is no such element.

Then, when looking at the source XML I can indeed find the element, but the accentuated character “é” has a different UTF-8 code than the one my keyboard produces.

Keyboard: é -> C3 A9
Appium: é -> 65 CC 81

Visually that’s the same character, but behind the scenes, it’s a totally different utf8 code, hence the issue.
Did anyone ever encounter such issue, or knows how I can get around it ?

ps: I don’t have this problem on Android. I recently upgraded to appium 1.5 but I’m not sure wether this issue is new to this version of appium or not

I have a monkey patch for Ruby that you might be interested in. Check out the last post here:

Thanks Wreed,
I could try to dig into the webdriver to see if this can be fixed there, but I’m not that experienced as a developpe., So I’ll wait a bit more and hope for more answers :slight_smile:

we used following workaround while comparing strings but not while search with xpath. maybe will help.

public Boolean testStringsEquals(String result, String expected) {
        //do normalization first before compare
        result = Normalizer.normalize(result, Normalizer.Form.NFD);
        expected = Normalizer.normalize(expected, Normalizer.Form.NFD);

        if(expected.equals(result)) {
            return true;
        } else {
            return false;

and link to issue

Hello Aleksei,

I’m not sure how you are using your function. From where I stand, what happens is that I ask appium to find an element using an xpath expression. Unfortunately it cannot find it because there is an encoding issue either on appium side or directly in the app.

Here is the flow

  1. Webdriver (node js) call to appium -> do you have following element “xpath expression” ?
  2. Appium does its checks and cannot find a match
  3. Appium replies to webdriver -> “no element found”

So I never get to a point where I can hold both “expected” and “actual” values in my code. It all happens within appium.

I tried to normalize my string (webdriver side) using unorm but it doesn’t help because that string is already correct, it’s the other string that should be normalized, the one held by appium.

try look for element with “(//*[@name=“News Cinéma”])[1]” and if it fails try to look with:

String txt = Normalizer.normalize("News Cinéma", Normalizer.Form.NFD);

just suggestion

Yeah, I tried that already, unfortunately it didn’t help as this is the string in the app / appium side causing the trouble, not the one on webdriver side.

is it not Appium side. you can see same problem in any iOS UI inspector.