Streaming text problem

Hi my first post and my first silly question :slight_smile:
I’m looking at using Xojo for a long running project which currently uses C#, my main reason for considering moving to Xojo is my project is using VS2010 and isn’t playing nice with Monodevelop and Mac, and I’d probably need to redo everything with Mono which I find awful to use
I’m chipping away at trying to get the key elements working with Xojo and hit my first problem

I have a Textarea which has some render options :

message 'Load C:\\Users\ ige\\Desktop\\marbles.obj\\marbles\\marbles000.scn.thea' message "./Scenes/Active/Cameras/## Current View ##/Make Active" message "Render" message 'SaveImage C:\\Users\ ige\\Desktop\\atest\\marbles000_R1_C1.png'

When I try to save the text it all goes on a single line with Windows and the Render software can’t read the script, I’ve tried different encoding but no luck at all
Here’s the code:

[code] Dim t as TextOutputStream
Dim f as FolderItem
f=GetFolderItem(Savetxt.Text +“temp.ipt.thea”)
if f <> Nil then
t = TextOutputStream.Create(f)
t.WriteLine (ConvertEncoding(Datatxt.text, Encodings.ASCII ))
//t.write (ConvertEncoding(Datatxt.text, Encodings.ASCII ))

t.Close                                            

End if[/code]

thanks
Nige

Silly answers ;-:slight_smile:

Use EndOfLine to add the platform appropriate end of line (Return, Line Feed =+ Return, whatever).

t.WriteLine is OK, but why do you set an encoding (ASCII) ?
I use UTF-8 encoding (the Xojo default) since Xojo (then REALbasic) introduce them (for my text files, outside coming text files ?)

Did you use that same encoding (ASCII) at reading time ?

It started off as t.Write (Datatxt.text) the encoding was added later on in desperation lol
I tried UTF-8, maybe I’m using it wrong?

Its the first time I’ve had this problem, the project has been rebuilt a scary amount of times over the past 4 years, flash, AutoIT, VB-net, c# and QT

Ahh got it:

Dim t as TextOutputStream Dim f as FolderItem f=GetFolderItem(Savetxt.Text +"temp.ipt.thea") if f <> Nil then t = TextOutputStream.Create(f) Dim s as String s=ReplaceLineEndings(Datatxt.Text,EndOfLine.Windows) t.Write (s) t.Close End if

thanks for your help Emile