New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged PR(s) for tests Registry files should be always UTF-16LE and newline compatible with UTF-16 #4654
base: develop
Are you sure you want to change the base?
Conversation
Even thou registry files encoded UTF-8 and UTF-8 BOM works for now, it may change in the future. To prevent some weird errors when using registry files enforce the usage of UTF-16LE (UCS-2 LE BOM) encoding. For more see: https://gist.github.com/SalviaSage/8eba542dc27eea3379a1f7dad3f729a0
It should be in Pester's |
If you try to edit a UTF16-LE file on GitHub, you will see the message
I would prefer we stick with formats that the tools we use support. |
Another issue is GitHub's commit change viewer doesn't show changes to UTF16-LE files, even if the file does't have non-ASCII characters in it. Instead it shows
If the file is converted to UTF-8, changes display fine, even if the file has non-ASCII characters. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for fixing the cases.
@niheaven what kind of feedback are you expecting? |
See @rasa's comments, and is there some solutions? And, could you please refactor the test using Pester's |
The is inherent git issue. Git does not support UTF-16XX encoding -natively - you should read the excellent reply at SO Why does not git support UTF-16 natively. Every project on GitHub that needs to use UTF16XX is not using the GitHub build-in tools. So you have to pull it, edited and push it. Nuisance I agree, but still better than having scoop throwing errors due to incorrect encoding. Since GitHub is now owned by Microsoft it should (don't know if they ever will) add the support to edit UTF16XX files in which their own registry is written.
That again issue of GitHub tools, which should be updated to support UTF16 encoding. There is not much I can do here. While I understand it is comfortable to view it directly here, I don't see registry files as huge problem. In my eyes, they don't change that often. |
I will just add something here as a maintainer.
Viewing files on GitHub is an extremely important part of the review process in buckets. There's so much activity here that it is impractical to open up the terminal, pull the commit and check the files for review in a PR every time. I agree not every PR has registry files, but not being able to view files occasionally on the web would be a blocker for me, personally. |
To summarize:
If it stops working in the future, let's fix the issue then. |
I closed this by accident, sorry. |
That is understandable. Maybe good approach is to push GitHub (e.g. dev polls) to improve the tooling now that it is owned by Microsoft. I find it funny because PowerShell uses Unicode which is UTF16 and is hosted here on GitHub.
I don't have an issue with that. The only problem I see is to identify the issue as connected to only UTF16. How do you say, without having the source, that the issue is only UTF16?
ad 1) True. The issue is that UTF16 is a native encoding, which means that there is a conversion done. ad 4) I can provide an example where I wanted to use UTF16 to avoid any conversion issues. I wanted to export programmatically registry into files, make changes and import them. Since reg.exe only exports into UTF16, I did not covert them, as conversion can fail. The whole process was done at UTF16. ad 5 & 6) Not yet. As I already mentioned above I think the major obsticle is github/git lacking UTF16 support. You can close the issue now and reopen it in the future if needed. One last important note for the future is that conversion between any formats can lead to errors/bugs. The native windows registry format is UTF16. |
This PR merges: