selenium
selenium copied to clipboard
[🐛 Bug]: Firefox ProfilesIni.readProfiles() does not handle files written in UTF-16 (?)
What happened?
Firefox ProfilesIni.readProfiles() does not handle files written in UTF-16, I think. The following line ignores the encoding bytes at the front of the file.
https://github.com/SeleniumHQ/selenium/blob/d40b1a8504003abc71f7d5f2baedc99f51f8f65a/java/src/org/openqa/selenium/firefox/ProfilesIni.java#L60
How can we reproduce the issue?
The following code returns `null` even though the profile is correct.
new ProfilesIni().
getProfile("nathan");
### Relevant log output
```shell
Not applicable
Operating System
Windows 11
Selenium version
Java 3.141.59
What are the browser(s) and version(s) where you see this issue?
Firefox 97.0.2
What are the browser driver(s) and version(s) where you see this issue?
GeckDriver 0.30.0 win64
Are you using Selenium Grid?
No
@numeralnathan, thank you for creating this issue. We will troubleshoot it as soon as we can.
Info for maintainers
Triage this issue by using labels.
If information is missing, add a helpful comment and then I-issue-template
label.
If the issue is a question, add the I-question
label.
If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted
label.
If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, W3C),
add the applicable G-*
label, and it will provide the correct link and auto-close the
issue.
After troubleshooting the issue, please add the R-awaiting answer
label.
Thank you!
Here is the profiles.ini
file that causes the problem. I had to rename it to .txt
because of Github.
I am not sure downloading this file will preserve the character set encoding. The HTTP header content-type
does not have a character set specified when downloading the file.
Notepad says this file is UTF-8 encoded. However, ProfileIni.readProfiles()
is getting String
s with a space between each character. So, I suspect that the file is UTF-16.
@numeralnathan apologies for the late reply. Just to confirm, is this issue happening in the latest Selenium release? (4.4.0).
I don't know. I worked around the issue. I gave my profiles.txt file and the bug should be easy to reproduce.
Right, but you were mentioning Selenium 3.x, and code has changed a lot between versions. Hence my question.
@numeralnathan It seems utf16 encoding is lost when I download your profile.txt from github. Could you please upload a ZIP files containing your profiles.ini?
I will close this but happy to reopen in case more information is provided.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.