Ok, I have a strange one here, I have a multi line file that has some accented characters, such as on some lines. I am writing a program that reads and does some things with this file. If I split the text by EndOfLine, it crashes the program on Mac, but not on Windows. If I don’t split by endofline then it doesn’t crash.
Here is the code that causes the crash, again only on Mac, not on Windows:
dim dlg as OpenDialog = new OpenDialog
dim f as FolderItem = dlg.ShowModal
if f <> nil then
dim ti as TextInputStream
dim Fulltxt as String
ti = TextInputStream.Open(f)
ti.Encoding = Encodings.UTF8
Fulltxt = ti.ReadAll
FullTxt = FullTxt.ReplaceAll(chr(10),EndOfLine)
FullTxt = FullTxt.ReplaceAll(chr(13),EndOfLine)
ti.Close
dim t() as String = Fulltxt.Split(EndOfLine)
dim FinalTxt as String
while UBound(t) >= 0
if FinalTxt = "" then
FinalTxt = t(0)
Else
FinalTxt = FinalTxt + t(0)
end if
wend
dim c as new Clipboard
c.Text = FinalTxt 'This causes either a continual loop or a crash on Mac, but works on Windows
end if
The following code will work just fine:
dim dlg as OpenDialog = new OpenDialog
dim f as FolderItem = dlg.ShowModal
if f <> nil then
dim ti as TextInputStream
dim Fulltxt as String
ti = TextInputStream.Open(f)
ti.Encoding = Encodings.UTF8
dim c as new Clipboard
c.Text = ti 'This causes either a continual loop or a crash on Mac, but works on Windows
end if
Anyone have any ideas on what might cause this?