Skip to content

Commit

Permalink
Write temporary file on bib import in jabrefhost.ps1 (#7918)
Browse files Browse the repository at this point in the history
* 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 JabRef/JabRef-Browser-Extension#274

* adding changelog entry

Co-authored-by: Sebastian Bachmann <bachmann@ilsb.tuwien.ac.at>
  • Loading branch information
reox and Sebastian Bachmann authored Jul 19, 2021
1 parent f6afd09 commit ed1fef7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve

### Changed

- The JabRefHost on Windows now writes a temporary file and calls `-importToOpen` instead of passing the bibtex via `-importBibtex`. [#7374](https://github.com/JabRef/jabref/issues/7374), [JabRef Browser Ext #274](https://github.com/JabRef/JabRef-Browser-Extension/issues/274)

### Fixed

- We fixed an issue when checking for a new version when JabRef is used behind a corporate proxy. [#7884](https://github.com/JabRef/jabref/issues/7884)
Expand Down
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 ed1fef7

Please sign in to comment.