0

I have searched extensively on this so I want to be clear on what I am doing and why it is different from other answers.

The breakdown: Form fields are filled out and submitted. On submit, a new window opens showing the output of the form The output is displayed in a textarea I use a flash Copy to Clipboard object to copy the output from the textarea to the clipboard Here's the problem When I paste that text into notepad or word it appears all on one line, even though in my code I have \n after every break.

I want to know how I can preserve the line breaks because if I paste the copied output into another textarea object, the text retains its formatting, but nowhere else.

If you need code or more clarification I will provide it, but that's the jist of the matter. Thanks for your replies.

user3715740
  • 27
  • 1
  • 6

2 Answers2

1

Check this topic out. Here it tells you that you should use \r\n for windows.

Even if this doesnt help its still good to know.

Community
  • 1
  • 1
Mmir
  • 357
  • 3
  • 10
  • Thanks for that (to both of you) I've looked at this more and the only place it seems to lose the \n formatting is in Notepad and this CRM web app I'm using. When you paste the copied output in to the little text fields its all smashed together, but when you mouse over it gives a preview window and is formatted correctly. Confusing... Also, the textarea input on the form is showing
    in the textarea output. I have the variavbe for the textarea input using both trim and stripslashes in the output file but it doesn't seem to care.
    – user3715740 Jun 18 '14 at 12:39
  • Paste into Notepad++ (free text editor, with many capabilities) to see if it understands the line breaks. That should show you what's going on. – Chris Thornton Jun 18 '14 at 12:44
  • Well I can't access Notepad++ at the moment (at work and there are no installs allowed on the desktops) but I did resolve the
    issue by taking OUT the nl2br on every textarea (I did it originally to output on a webpage, but they aren't needed now that I'm outputting to a text area. Any other ideas? I know it is retaining the formatting in the clipboard, but not all applications I paste to read it. Is there a command or something that fixes that? Or is it just the fault of the application I paste to and I'm screwed? Thanks for the quick replies!
    – user3715740 Jun 18 '14 at 13:34
0

Is this perhaps related to the Windows CR+LF end-of-line sequence? Can you try with \n\r and see if that helps?

Mattias Backman
  • 927
  • 12
  • 25