PDA

View Full Version : \r\n in flash


ricmetal
05-17-2010, 02:00 PM
hi
i have a html textarea where users insert text, and it is saved to a database- mysql.
on db export to text file, i notice each line break as \r\n.
loading the text back into the html textarea, the line brekas are correct. each \r\n equals one line break.
but when loaded into flash, the text outputs double the amount of line breaks.
one \r\n in the db equals to two line breaks in flash.
two \r\n equals four line breaks in flash.

anyone know why this occurs?

in the image below the first paragraph has one line break in the database and also one line break is how it shoes in the textarea in html. in the second paragraph, two line breaks.

http://img215.imageshack.us/img215/6704/60752605.png

johnmazz
05-20-2010, 03:10 PM
My guess is that flash is interpreting both /r and /n as separate line breaks, but not sure. What if you added a little PHP or something to convert all /r/n in the string to just /r or just /n before it passes the text back to flash?

ricmetal
05-20-2010, 04:12 PM
yep flash does see \r\n as two lines. i found that out.
also found that replace is the only solution.
so yeah, u are right on the money