www.webdeveloper.com
Results 1 to 3 of 3

Thread: converting \r\n??

  1. #1
    Join Date
    Feb 2008
    Posts
    136

    converting \r\n??

    Hi I am writing a script that allows the user to send a simple email to our admin officer. the problem is that the email gets sent but when you read it you would see a bunch of those "\r\n" incorporated inside the email.

    How do I get rid of these tags and convert them into breaks? I tried replace "\r\n" with "<br/>" and it still doesnt do anything? PLease help!

  2. #2
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,415
    What are you using to create the message: Textbox or Textarea or something else?

    What kind of replacement command are you using to replace the '\r\n' values?

  3. #3
    Join Date
    Nov 2002
    Location
    Flint, Michigan, USA
    Posts
    598
    Sometimes and end-of-line is just a return (\r) code. Sometimes just a new-line (\n) code. Sometimes it is both in either (\r\n or \n\r) order. I handle all possibilities with:

    Code:
      Value=Value.replace(/\n\r/g,'\n');
      Value=Value.replace(/\r\n/g,'\n');
      Value=Value.replace(/\r/g,  '\n');
      Value=Value.replace(/\n/g,  '<br>');

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles