CRLF characters in HTML page ?

Discussion in 'ASP General' started by Dorian, Dec 4, 2008.

  1. Dorian

    Dorian Guest

    MS I'm formatting an email in HTML format with data from my MS Access DB. All
    is fine except the text from text fields which contains carriage return-line
    feeds is unformatted. Does anyone know if there is some way to make the HTLM
    recognize the CRLF characters and format the text column data correctly?
    Thanks.
     
    Dorian, Dec 4, 2008
    #1
    1. Advertisements

  2. Dorian

    Evertjan. Guest

    =?Utf-8?B?RG9yaWFu?= wrote on 04 dec 2008 in
    microsoft.public.inetserver.asp.general:

    > MS I'm formatting an email in HTML format with data from my MS Access
    > DB. All is fine except the text from text fields which contains
    > carriage return-line feeds is unformatted. Does anyone know if there
    > is some way to make the HTLM recognize the CRLF characters and format
    > the text column data correctly? Thanks.


    vbs:

    newText = replace(oldText, vbCrLf, "<br>")

    jscript:

    var newText = oldText.replace(/\n/g,'<br>');


    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Dec 4, 2008
    #2
    1. Advertisements

  3. "Dorian" wrote:
    > MS I'm formatting an email in HTML format with data from my MS Access DB.
    > All is fine except the text from text fields which contains carriage
    > return-line feeds is unformatted. Does anyone know if there is some way
    > to make the HTLM recognize the CRLF characters and format the text column
    > data correctly?


    You can use replace those CRLF instances with <br> elements. Assuming you
    are using an ADODB.Recordset to grab the data:

    JScript -----
    outputText += RS.Fields("myTextField").Value.replace(/\r\n/g,"<br/>")

    VBScript -----
    outputText = outputText + _
    Replace(RS.Fields("myTextField").Value, vbCrLf, "<br/>")


    JScript String.replace:
    http://msdn.microsoft.com/en-us/library/t0kbytzc(VS.85).aspx
    JScript Regular Expression Object:
    http://msdn.microsoft.com/en-us/library/h6e2eb7w(VS.85).aspx

    VBScript Replace:
    http://msdn.microsoft.com/en-us/library/238kz954(VS.85).aspx

    ADO API Reference:
    http://msdn.microsoft.com/en-us/library/ms807498.aspx



    --
    Dave Anderson

    Unsolicited commercial email will be read at a cost of $500 per message. Use
    of this email address implies consent to these terms.
     
    Dave Anderson, Dec 4, 2008
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kevin Spencer

    Re: how to check CRLF in C#

    Kevin Spencer, Aug 25, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    28,519
    Jerry III
    Aug 27, 2003
  2. Jack Wright

    Problem in CRLF in multiline fields

    Jack Wright, Apr 20, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    544
    Jack Wright
    Apr 21, 2004
  3. Michael Persaud

    CRLF How does it work for asp.net???!!

    Michael Persaud, May 27, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    6,491
    Michael Persaud
    May 27, 2004
  4. Andrew

    ASCII file without crlf's

    Andrew, Jun 21, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    540
    M. Zeeshan Mustafa
    Jun 22, 2004
  5. George Durzi

    Escaping a CrLf in JavaScript

    George Durzi, Jul 6, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    3,629
    George Durzi
    Jul 6, 2004
  6. =?Utf-8?B?VG9tYXM=?=
    Replies:
    0
    Views:
    568
    =?Utf-8?B?VG9tYXM=?=
    Feb 7, 2005
  7. Jim in Arizona

    CRLF ..

    Jim in Arizona, Aug 24, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    1,256
    Jim in Arizona
    Aug 24, 2005
  8. Stefan Mueller
    Replies:
    3
    Views:
    34,256
    Stefan Mueller
    Jul 23, 2006
Loading...