diff --git a/crates/nu-std/std/mod.nu b/crates/nu-std/std/mod.nu index b800adf11e..b0ec84d134 100644 --- a/crates/nu-std/std/mod.nu +++ b/crates/nu-std/std/mod.nu @@ -142,6 +142,7 @@ export def clip [ --no-notify: bool # do not throw a notification (only on linux) --no-strip: bool # do not strip ANSI escape sequences from a string --expand (-e): bool # auto-expand the data given as input + --codepage (-c): int # the id of the codepage to use (only on Windows), see https://en.wikipedia.org/wiki/Windows_code_page, e.g. 65001 is for UTF-8 ] { let input = ( $in @@ -161,16 +162,18 @@ export def clip [ } }, "windows" => { - chcp 65001 # see https://discord.com/channels/601130461678272522/601130461678272524/1085535756237426778 - check-clipboard clip.exe --system $"('xorg' | pretty-command) on linux" + if $codepage != null { + chcp $codepage + } + check-clipboard clip.exe --system "Windows" $input | clip.exe }, "macos" => { - check-clipboard pbcopy --system macOS + check-clipboard pbcopy --system "MacOS" $input | pbcopy }, "android" => { - check-clipboard termux-clipboard-set --system Termux + check-clipboard termux-clipboard-set --system "Termux" $input | termux-clipboard-set }, _ => { @@ -290,4 +293,4 @@ Startup Time: ($nu.startup-time) # Return the current working directory export def pwd [] { $env.PWD -} \ No newline at end of file +}