Uploaded image for project: 'Scala Programming Language'
  1. Scala Programming Language
  2. SI-6592

Unexpected result of scala.io.Source.fromFile(...).mkString(",") evaluation

    Details

    • Type: Bug
    • Status: CLOSED
    • Priority: Minor
    • Resolution: Not a Bug
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Library (Misc)
    • Labels:
    • Environment:

      scala 2.9.2, java 1.6.0_24, Ubuntu 11.10

      Description

      I've 2 files that have only one difference - "\r\n" sequence in the test.txt
      [vladimir@vladimir tmp]$ cat test.txt
      line1
      line2
      line3
      [vladimir@vladimir tmp]$ cat test2.txt
      line1
      line2
      line3[vladimir@vladimir tmp]$

      I try to execute in the REPL:

      scala> scala.io.Source.fromFile("/tmp/test.txt").mkString(",")
      res17: String =
      ,l,i,n,e,1,
      ,l,i,n,e,2,
      ,l,i,n,e,3,
      "

      scala> scala.io.Source.fromFile("/tmp/test2.txt").mkString(",")
      res18: String =
      ,,i,n,e,1,
      ,l,i,n,e,2,
      ,l,i,n,e,3

      scala>

      As you can see, for test2.txt file the first "l" character ommited. I think, that it isn't expected behaviour.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                apm A. P. Marki
                Reporter:
                vkuptcov Vladimir Kuptsov
              • Votes:
                1 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: