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. Advertising

  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. Advertising

  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. Advertising

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. Jerry III

    Re: how to check CRLF in C#

    Jerry III, Aug 25, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    790
    Jerry III
    Aug 25, 2003
  2. Kevin Spencer

    Re: how to check CRLF in C#

    Kevin Spencer, Aug 25, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    27,924
    Jerry III
    Aug 27, 2003
  3. Simon Chung-Jen Chuang

    Re: how to check CRLF in C#

    Simon Chung-Jen Chuang, Aug 26, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    417
    Simon Chung-Jen Chuang
    Aug 26, 2003
  4. Jack Wright

    Problem in CRLF in multiline fields

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

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

    Michael Persaud, May 27, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    5,902
    Michael Persaud
    May 27, 2004
Loading...

Share This Page