From 2315aad732e205248edddf158bcc4eac982cf76b Mon Sep 17 00:00:00 2001 From: Molunerfinn Date: Tue, 12 Mar 2019 11:20:27 +0800 Subject: [PATCH] Fixed: WIN10 powershell output encoding bug --- package.json | 2 +- static/windows.ps1 | 19 ++++++++++++------- yarn.lock | 6 +++--- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 5e675c6..6b208b2 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,7 @@ "lowdb": "^1.0.0", "md5": "^2.2.1", "melody.css": "^1.0.2", - "picgo": "^1.2.6", + "picgo": "^1.2.8", "qiniu": "^7.1.1", "vue": "^2.3.3", "vue-electron": "^1.0.6", diff --git a/static/windows.ps1 b/static/windows.ps1 index 8ba85b8..ca1c6bc 100644 --- a/static/windows.ps1 +++ b/static/windows.ps1 @@ -1,6 +1,9 @@ +# Adapted from https://github.com/octan3/img-clipboard-dump/blob/master/dump-clipboard-png.ps1 param($imagePath) -# Adapted from https://github.com/octan3/img-clipboard-dump/blob/master/dump-clipboard-png.ps1 +# https://github.com/PowerShell/PowerShell/issues/7233 +# fix the output encoding bug +[console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding Add-Type -Assembly PresentationCore function main { @@ -27,13 +30,15 @@ function main { } try { - $file = Get-Clipboard -Format FileDropList - if ($file -ne $null) { - Convert-Path $file - Exit 1 - } + # For WIN10 + $file = Get-Clipboard -Format FileDropList + if ($file -ne $null) { + Convert-Path $file + Exit 1 + } } catch { - main + # For WIN7 WIN8 WIN10 + main } main \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 47259d0..74afb47 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6765,9 +6765,9 @@ performance-now@^2.1.0: version "2.1.0" resolved "http://registry.npm.taobao.org/performance-now/download/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" -picgo@^1.2.6: - version "1.2.7" - resolved "http://registry.npm.taobao.org/picgo/download/picgo-1.2.7.tgz#f14a7cdad11eb30b2bfc0cb6045771015922c764" +picgo@^1.2.8: + version "1.2.8" + resolved "http://registry.npm.taobao.org/picgo/download/picgo-1.2.8.tgz#c65a2f680820cd1d5382a37b5522e0bb1004b765" dependencies: chalk "^2.4.1" commander "^2.17.0"