diff --git a/CHANGELOG.md b/CHANGELOG.md index e9fe820..a8645a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed -- zsh: completions clashing with `zsh-autocomplete`. +- Zsh: completions clashing with `zsh-autocomplete`. +- Fzf: 'invalid option' on macOS. +- PowerShell: handle UTF-8 encoding correctly. ## [0.8.3] - 2022-09-02 diff --git a/templates/powershell.txt b/templates/powershell.txt index 6edc3cb..3df927a 100644 --- a/templates/powershell.txt +++ b/templates/powershell.txt @@ -5,6 +5,18 @@ # Utility functions for zoxide. # +# Call zoxide binary, returning the output as UTF-8. +function __zoxide_bin { + $encoding = [Console]::OutputEncoding + try { + [Console]::OutputEncoding = [System.Text.Utf8Encoding]::new() + $result = zoxide @args + return $result + } finally { + [Console]::OutputEncoding = $encoding + } +} + # pwd based on zoxide's format. function __zoxide_pwd { $cwd = Get-Location @@ -86,10 +98,10 @@ function __zoxide_z { else { $result = __zoxide_pwd if ($null -ne $result) { - $result = zoxide query --exclude $result -- @args + $result = __zoxide_bin query --exclude $result -- @args } else { - $result = zoxide query -- @args + $result = __zoxide_bin query -- @args } if ($LASTEXITCODE -eq 0) { __zoxide_cd $result $true @@ -99,7 +111,7 @@ function __zoxide_z { # Jump to a directory using interactive search. function __zoxide_zi { - $result = zoxide query -i -- @args + $result = __zoxide_bin query -i -- @args if ($LASTEXITCODE -eq 0) { __zoxide_cd $result $true }