diff options
author | Canop <cano.petrole@gmail.com> | 2021-03-02 17:17:53 +0100 |
---|---|---|
committer | Canop <cano.petrole@gmail.com> | 2021-03-02 17:17:53 +0100 |
commit | 872af83b128ae9fe113860d23c61778204da8fb2 (patch) | |
tree | 2489d87734c778e99d93f7f8f91e016bd5c8c64b /website | |
parent | 3b8358034375b7907579b50229838c08e9fdad6d (diff) | |
parent | a1a8d06cad584eae954a3796943a71d5aa3194ed (diff) |
Merge branch 'patch-1' of https://github.com/Stargateur/broot into Stargateur-patch-1
Diffstat (limited to 'website')
-rw-r--r-- | website/docs/common-problems.md | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/website/docs/common-problems.md b/website/docs/common-problems.md index 29ccf45..4f62442 100644 --- a/website/docs/common-problems.md +++ b/website/docs/common-problems.md @@ -55,6 +55,40 @@ I have no solution for that. If you know how to tackle the problem, the maintain Even Microsoft doesn't support them anymore. If you have a cheap solution it's welcome but I don't have any. +# Trouble with PowerShell Encoding + +PowerShell is known to have problem with text encoding, for some reason the default is not UTF-8, if you want more compatibility it's advice to set encoding to UTF-8: + +Quick & Dirty (only for current session of powershell): use the command `[Console]::OutputEncoding = [System.Text.Encoding]::UTF8` + +[Profile](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles?view=powershell-7.1) (for every new powershell session): + +This will create a profile if it doesn't exist: +```powershell +if (!(Test-Path -Path $PROFILE)) { + New-Item -ItemType File -Path $PROFILE -Force +} +``` + +`notepad $PROFILE` will open the profile config. You need to add `[Console]::OutputEncoding = [System.Text.Encoding]::UTF8` somewhere. + +The next will allow script to run for this user and require admin privilege, [source](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.security/set-executionpolicy?view=powershell-7.1): + +```powershell +Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser +Unblock-File -Path $PROFILE +``` + +Now, this should load your profile everytime, you can check the current encoding using `[Console]::Out`, don't forget to open a new powershell window. + +```none +Encoding FormatProvider NewLine +-------- -------------- ------- +System.Text.UTF8Encoding fr-FR ... +``` + +Try out `br -c :pt | Out-File broot_output -Encoding UTF8`, [`Out-File`](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/out-file?view=powershell-7.1#parameters) will correctly interpret the input now, you are not force to encode the output file in UTF-8 the complete list of encoding format is in the doc. + # Broot doesn't seem as fast or feature complete on Windows It isn't. I'm not a Windows programmer and I don't even have a machine to test. I'd welcome the help of a programmer with the relevant competences and the will to improve broot. |