From e8b45e81122c788f64e9cf8669f1055c417e9b34 Mon Sep 17 00:00:00 2001 From: Sebastian Bachmann Date: Mon, 19 Jul 2021 13:56:32 +0200 Subject: [PATCH] Write temporary file on bib import This resolves an issue where the encoding somehow got lost when using the Jabref Browser extension. It will now write a temporary file with UTF-8 encoding rather than passing the bibtex on the commandline. See https://github.com/JabRef/JabRef-Browser-Extension/issues/274 --- buildres/windows/JabRefHost.ps1 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/buildres/windows/JabRefHost.ps1 b/buildres/windows/JabRefHost.ps1 index 9c876805305..dc90a582921 100644 --- a/buildres/windows/JabRefHost.ps1 +++ b/buildres/windows/JabRefHost.ps1 @@ -38,7 +38,12 @@ try { #$wshell.Popup($message.Text,0,"JabRef", 0x0 + 0x30) $messageText = $message.Text.replace("`n"," ").replace("`r"," ") - $output = & $jabRefExe -importBibtex "$messageText" *>&1 + $tempfile = New-TemporaryFile + # WriteAllLines should write the file as UTF-8 without BOM + # unlike Out-File which writes UTF-16 with BOM in ps5.1 + [IO.File]::WriteAllLines($tempfile, $messageText) + $output = & $jabRefExe -importToOpen $tempfile *>&1 + Remove-Item $tempfile #$output = "$messageText" #$wshell = New-Object -ComObject Wscript.Shell #$wshell.Popup($output,0,"JabRef", 0x0 + 0x30)