@Booticus: Your application has a bug and that's the reason it's not working on BLIde and it's working on standard IDE. BLIde uses Unicode formating, and your application doesn't takes in consideration the text encoding. The official IDE works on ANSI in your windows distro, and that makes your program to work, but it will stop workin on other windows distros, or on Mac or Linux. This is a correct version of your program (I've implemented a little class to treat encoding recognition based on the LoadText function of the offical BRL mods)
SuperStrict
Local theFilename:String="test.bmx"
Local Reader:TextFileReader = New TextFileReader
Local TextStream:TTextStream = reader.CreateStream(thefilename)
While textstream.Eof() = False
Print textstream.ReadLine()
Wend
End
Type TextFileReader
Function CreateStream:TTextStream(url:Object,DetectEncoding:Int = True,ForceEncoding:Int = 0 )
Local Stream:TStream=ReadStream(url) 'This is the base stream
If Stream = Null Then Return Null 'Unable to open URL
If detectencoding = False Then
Local TStream:TTextStream=TTextStream.Create( Stream,forceencoding)
Return TStream
Else
Local TStream:TTextStream=TTextStream.Create( Stream,EncodingDetector(url))
Return TStream
EndIf
End Function
Function EncodingDetector:Int(url:Object)
Local format:Int = 0 'This is to store the encoding
Local Stream:TStream=ReadStream(url) 'This is the base stream
If not Stream.Eof() 'check if there is data to read
Local c:Byte=Stream.ReadByte()
If not Stream.Eof()
Local d:Byte=Stream.ReadByte() 'Get the firt byte to get the encoding
If c=$fe and d=$ff 'if its FF and FE (Big endian byte order)
format=TTextStream.UTF16BE
Else If c=$ff and d=$fe 'Little endian byte order
format=TTextStream.UTF16LE
Else If c=$ef and d=$bb
If not Stream.Eof()
Local e:Byte=Stream.ReadByte()
If e=$bf format=TTextStream.UTF8
EndIf
EndIf
EndIf
EndIf
Return format
End Function
End Type
So no BLIde bug here. On next version 0.7.51 you will be able to select the default BLIde encoding (by default it will be Unicode Big Endian).Oh, and you were getting strange characters becouse previous versions of BLIde were not compatible with Unicode. (open those files on notepad, and save them as ANSI if you want to use them in ancient versions of BLIde).
@Everybody:download the beta if you wish here:
http://www.blide.org/beta/blide-0-7-50.zipfor the .net version, you should update your .net version using Windows Update, otherwise, download the correct .net version from microsoft, or uninstall the .net you have and install BLide 0.7.50 directly, as
it will automatically download the correct and last Microsoft .net stable version for you.Please, let me know if you download the beta, and send any bug report using the bug report dialog in version 0.7.50