SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Guru
    Join Date
    Sep 2004
    Location
    Provo, UT
    Posts
    858
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Is \n\n or \r\r\n more of a standard to use between paragraphs of text?

    The mySQL client I use, Querious, adds \n\n between paragraphs while editing the contents of a column. However, the text area HTML tag on a webpage inserts \r\r\n between paragraphs. Which one, \n\n or \r\r\n is more of an accepted standard?
    Convert your dollars into silver coins. www.convert2silver.com

  2. #2
    SitePoint Wizard TheRedDevil's Avatar
    Join Date
    Sep 2004
    Location
    Norway
    Posts
    1,196
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    I am not sure I completely follow what your trying to do, if you could explain a little more it would be easier to help.

    Anyway:

    \r is carriage return and \n is line feed.

    I won't go into the difference between them and how they work, as its mainly connected how printers was working a long time ago. Plus of course you can use them still in some consoles as well.

    In the general scope, the difference with them on what your trying to do (assume web development, or creating documents) is:

    \n is line separator in Unix
    \r\n is line separator in Windows
    \r is used by Mac up to OS 9
    \n is used from Mac OS X

  3. #3
    SitePoint Guru
    Join Date
    Sep 2004
    Location
    Provo, UT
    Posts
    858
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Well, I'm trying to clean up the data in my database. So if I need to change all of the \r\r\n to \n\n, then that is what I'l work on. I found a function on the web that takes text from the database and correctly adds the paragraph opening and closing tags. However, it seems to only work when the data from the database is using \n\n between paragraphs.

    So is the code on my website incorrect if the standard between paragraphs should be \n\n ?

    Thanks!
    Convert your dollars into silver coins. www.convert2silver.com

  4. #4
    SitePoint Wizard TheRedDevil's Avatar
    Join Date
    Sep 2004
    Location
    Norway
    Posts
    1,196
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    The way they are now is wrong, most probably the documents has been accessed or modified by different operating systems.

    What you need to find out first is what OS the documents will be used on, and then change the line separators accordingly. I.e. if its UNIX/LINUX go with \n per line.

  5. #5
    SitePoint Guru
    Join Date
    Sep 2004
    Location
    Provo, UT
    Posts
    858
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    This is a web based project, so I have no control what type of OS the end user is on when they access the website. I develop the website and the mySQL client are Mac based.
    Convert your dollars into silver coins. www.convert2silver.com


Bookmarks

Posting Permissions

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