Closed smitranic closed 4 years ago
Just to clarify, this issue manifests itself only if the user explicitly sets the 'hidden' attribute on the .cdHistory file.
Thank you for taking time to maintain this script, much appreciated.
Can you please verify if file encoding will be a problem by using Set-Content? See here https://stackoverflow.com/questions/10655788/powershell-set-content-and-out-file-what-is-the-difference
PowerShell Core uses UTF8 by default for both Set-Content and Out-File, but you are correct, older PowerShell (v5 and earlier) don't. So I have added the -Encoding UTF8 parameter to Set-Encoding and tested it with folders with non-ANSI characters and they get saved in UTF8.
Everything seems to work fine with Unicode characters now in both PowerShell Core (pwsh.exe) and PowerShell Desktop (powershell.exe).
Thank you once again for taking the time to help me maintain this.
Will publish to the PowerShell gallery in the next few days.
Package published https://www.powershellgallery.com/packages/z/1.1.13
Update WriteHistoryToDisk function to use Set-Content instead of Out-File since Out-File throws an access denied exception when trying to write to a hidden file.
A common practice on Windows is to make the dotfiles in the user home folder hidden, and doing that on .cdHistory currently causes an exception whenever .cdHistory is updated.