0

I am testing an app in French where I grab the text from screen using Seetest and store it in a Python variable. The method I am using is GetAllValues , I then compare it with the expected text that is stored in an xml which i parse using lxml parser.

I basically compare the text and spit out the differences using set operations. It works fine in english/german too but French has issues.

I tried converting every string into unicode and compare, it still doesn't work. Any suggestions?

def converting_to_unicode(list_of_strs,unicode_string=[]):
        unicode_string=[]
        for string in list_of_strs:
            #print string
            if isinstance(string,unicode): 
             unicode_string.append(unicode(string.encode('latin1'),encoding='latin1'))
            else:
                unicode_string.append(unicode(string,encoding='latin1'))
        return unicode_string

And Reading the text from screen and xml

 actual_text_screen = converting_to_unicode(var1)
 expected_text_from_xml= converting_to_unicode(el_list)

 mutually_exclusive = list(set(actual_text_screen)^set(expected_text_from_xml))

TIA

Deduplicator
  • 44,692
  • 7
  • 66
  • 118
  • 1
    "Doesn't work" gives us little to go on. Please provide sample input, the resulting output (if any), what output you expect, and the full stack trace of any error message that you get. Otherwise we can't replicate your problem. – BoarGules Jun 12 '17 at 00:25
  • Welcome to SO. Please read this [how-to-ask](http://stackoverflow.com/help/how-to-ask) and follow the guidelines there to refine your question with additional information, such as code and error message to describe your programming problem. – thewaywewere Jun 12 '17 at 00:52
  • Consider upgrading to Python 3, if you can. It's been taking over for a while now, and unicode-related things are much more consistent now. – lenz Jun 12 '17 at 18:20

0 Answers0