summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/session/FileBackedHistory.scala12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/interpreter/session/FileBackedHistory.scala b/src/compiler/scala/tools/nsc/interpreter/session/FileBackedHistory.scala
index 5f11a0ea8f..d33658b6cd 100644
--- a/src/compiler/scala/tools/nsc/interpreter/session/FileBackedHistory.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/session/FileBackedHistory.scala
@@ -46,9 +46,17 @@ trait FileBackedHistory extends JLineHistory with JPersistentHistory {
if (!historyFile.canRead)
historyFile.createFile()
- val lines: IndexedSeq[String] =
+ val lines: IndexedSeq[String] = {
try historyFile.lines().toIndexedSeq
- catch { case _: Exception => Vector() }
+ catch {
+ // It seems that control characters in the history file combined
+ // with the default codec can lead to nio spewing exceptions. Rather
+ // than abandon hope we'll try to read it as ISO-8859-1
+ case _: Exception =>
+ try historyFile.lines("ISO-8859-1").toIndexedSeq
+ catch { case _: Exception => Vector() }
+ }
+ }
repldbg("Loading " + lines.size + " into history.")