File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111# Stop the script if an error occurs.
1212$ErrorActionPreference = ' Stop'
1313
14- $ScriptVersion = " 2.5.0-beta.3 "
14+ $ScriptVersion = " 2.5.0-beta.4 "
1515
1616function TerminateWithError {
1717 param (
@@ -693,6 +693,9 @@ public static extern void CoTaskMemFree(IntPtr pv);
693693 }
694694
695695 if (-not $IsTest ) {
696+ # Important for the function Out-ColoredLog
697+ $options += @ (" --encoding" , " utf-8" )
698+
696699 # If video title contains a dot as last character, delete it
697700 $options += @ (" --replace-in-metadata" , " title" , ' \.$' , " " )
698701 # escape every pwsh chars in title
@@ -780,6 +783,10 @@ public static extern void CoTaskMemFree(IntPtr pv);
780783 & yt- dlp $options
781784 }
782785 else {
786+ # If we don’t set everything in utf-8, the $InputObject from pipeline will be corrupted
787+ # Check https://github.com/PowerShell/PowerShell/issues/25698#issuecomment-4599829781
788+ [Console ]::InputEncoding = [Console ]::OutputEncoding = [System.Text.UTF8Encoding ]::new()
789+
783790 & yt- dlp $options 2>&1 | Out-ColoredLog
784791 }
785792
You can’t perform that action at this time.
0 commit comments