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
I'm trying to write a test against a HTML file containing some non ascii characters. Very simple example is this file with a non-ascii dash between words Hello, World:
Running this test case fails with UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 140: ordinal not in range(128) error message:
*** Settings ***
Library HttpLibrary.HTTP
*** Test Cases ***
Test unicode
Create Http Context supl.cz http
GET /page2.html
Response Body Should Contain Hello
Testing a page without a dash is fine (note page1.html instead of page2.html)
*** Settings ***
Library HttpLibrary.HTTP
*** Test Cases ***
Test unicode
Create Http Context supl.cz http
GET /page1.html
Response Body Should Contain Hello
Using a dash character in test script seems to be fine (the following test is expected to fail, because page1.html does not contain "Hello — world" but contains "Hello world"):
*** Settings ***
Library HttpLibrary.HTTP
*** Test Cases ***
Test unicode
Create Http Context supl.cz http
GET /page1.html
Response Body Should Contain Hello — world
It looks like we need support for decoding response body to unicode so it can be compared to unicode strings.
The text was updated successfully, but these errors were encountered:
It seems adding a new method
response_text_should_contain which would use exactly the same code as response_body_should_contain except checking self.response.text instead of self.response.body would solve this issue.
'body' is bytes string, 'text' is unicode string, which is what I'm looking for.
If we have an unicode character in the url (e.g. é) httplibrary GET is not able to be completed either. So it is not only handling the response.body where the error occurs.
I'm trying to write a test against a HTML file containing some non ascii characters. Very simple example is this file with a non-ascii dash between words Hello, World:
Running this test case fails with UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 140: ordinal not in range(128) error message:
Testing a page without a dash is fine (note page1.html instead of page2.html)
Using a dash character in test script seems to be fine (the following test is expected to fail, because page1.html does not contain "Hello — world" but contains "Hello world"):
It looks like we need support for decoding response body to unicode so it can be compared to unicode strings.
The text was updated successfully, but these errors were encountered: