I am creating a AIR application in flex. I have a textArea having a string something like –
AAA BBB CCC DDD
QQQ WWW EEE SSS
KKPPP SSSL AAAS
I want this to save this into .txt file.
I am using –
file.save(output.text,"testFile.txt");
But its is saving everything in 1 line. When I open the file using notepad everything is coming as Single line.
Does flex provide any functionality using which I can save the contents of multiline Text Area into .txt file?
The output string has got the ‘\n’ but notepad is not able to recognize it. Is it a Flex issue or Windows notepad issue? If it is notepad issue then is there any way to work around this from Flex file io?
Please help. 🙂
Notepad is the culprit – it only understands
\r\nnewlines (the Windows newlines).Open the file in wordpad or notepad++ and you can see the text in multiple lines.
If you want to support notepad too, you can replace
\nwith\r\nbefore writing it to the file – smart editors will convert them to single\nbefore displaying it: