Skip to content

Commit

Permalink
Write temporary file on bib import
Browse files Browse the repository at this point in the history
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 JabRef/JabRef-Browser-Extension#274
  • Loading branch information
Sebastian Bachmann committed Jul 19, 2021
1 parent f6afd09 commit e8b45e8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion buildres/windows/JabRefHost.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e8b45e8

Please sign in to comment.