-
Notifications
You must be signed in to change notification settings - Fork 52
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
Out-IniFile: UTF-8 without BOM #68
Comments
There was a reason for using But neither of the two commands support What can be done, is to dynamically extend the allowed values for parameter depending on the powershell version. But I haven't had much time for working on the module anyway. And I would first finish the new CICD and the new major version before looking into this. |
The UTF8 encoding, which |
Just getting to grips with PowerShell and your excellent script. I noted something which may be related to this issue. It doesn't cause me any functional issues, just cosmetics. The INI file I am processing is German, so it has the German umlaut characters within the comments in the INI Here is an example: ;## ausführliche Variante Becomes ;## ausf�hrliche Variante |
In my environment (Windows), the Out-IniFile function does encode using the UTF8 parameter, but the resulting file encoding is UTF8 with BOM. To get UTF8 (no BOM), the Out-IniFile and its internal Out-Keys functions need to be updated to support the "Default" encoding. This was the parameter change I made (to both functions) to get the resulting file encoded correctly.
Cheers |
I also faced the same problem. For me the easiest workaround was to do something like this.
|
Hi Oliver! Thank you very much for your module - I love it - it is a great help to me!
I use PsIni in my project PSGPPreferences where I update GPT.INI in Group Policies with it. Unforunately recently I stumbled upon this bug: exchange12rocks/PSGPPreferences#28
I need to be able to write those ini-files in UTF-8, but without BOM, in a single transaction, i.e. I cannot remove BOM afterwards.
Currently
Out-IniFile
usesOut-File
, which always writes BOM in Windows PowerShell, unless the user disables it globally. TBH I'd rather do not introduce global changes on my users' PCs.Is there a particular reason
Out-IniFile
usesOut-File
? Would it be possible to switch toSet-Content
? As far as I am aware it supports UTF-8 w/o BOM.The text was updated successfully, but these errors were encountered: