WebElement.getText() function and utf8

允我心安 提交于 2021-01-03 06:20:13

问题


May i assume that for every web page the WebElement.getText() function does return utf8 Strings, or can it have other encodings?

If there could be other encodings, how can i identify it and convert it to utf8?


回答1:


I don't know no one good way(maybe if you like reflection, you can hack and rewrite) to do getText() return needed encoding. But in this Selenium web driver and multillanguage I wrote some way to encode String.




回答2:


I don't think so. According to the API, getText() returns a String. You will have to find the encoding of that from the page headers.



来源:https://stackoverflow.com/questions/18353988/webelement-gettext-function-and-utf8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!