SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict rabbitsfeat's Avatar
    Join Date
    Nov 2006
    Posts
    334
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Coding punctuation

    I'm using Dreamweaver CS3 and would like to know which is better to use when coding punctuation, directly in the xhtml.

    Say I want an em dash for instance. Dreamweaver allows me 2 ways to code this. These are:

    —

    or

    & # 8 2 1 2 ; (it kept showing the actual symbol so I've put a space between each part... it should all be bunched together.)

    Which is better to use?

    The same goes for curly quotes; 2 ways to code it.

    I'd like to know if there's any standard regarding this, or if not which method people generally use.

    Thanks for any help given.
    Last edited by rabbitsfeat; Sep 4, 2008 at 03:31. Reason: symbol showing up instead of code

  2. #2
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'd say the best way is to write the punctuation literally (as '—') using a character encoding that allows this (e.g., UTF-8).

    Whether you use numeric character references (NCRs) like — or entity references like — is mostly a matter of taste. Unless you're using an XHTML doctype declaration, in which case you definitely shouldn't use entity references. (They're not guaranteed to work in XHTML, since the entities are defined in the DTDs, which most XML parsers don't read.)
    Birnam wood is come to Dunsinane

  3. #3
    SitePoint Guru Chroniclemaster1's Avatar
    Join Date
    Jun 2007
    Location
    San Diego, CA
    Posts
    784
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I generally avoid curly quotes in my webpages. They're pretty, but using straight quotes allow you to just type without inserting lots of extra references. I have some pages that are research based and it's easy for the quotation marks to pile up quickly.
    Whatever you can do or dream you can, begin it.
    Boldness has genius, power and magic in it. Begin it now.

    Chroniclemaster1, Founder of Earth Chronicle
    A Growing History of our Planet, by our Planet, for our Planet.

  4. #4
    SitePoint Addict rabbitsfeat's Avatar
    Join Date
    Nov 2006
    Posts
    334
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Unless you're using an XHTML doctype declaration, in which case you definitely shouldn't use entity references.
    Sorry but it's probably just me but I don't quite understand the above sentence.

    I'm using xhtml transitional 1.0 and charset=utf-8.

    So with this should I just put quotes and emdashes in literally or use the character references.
    I generally avoid curly quotes in my webpages.
    I've read in web typography books and resources on the web that curly quotes should be used and not inch marks ".

    I'd like to hear what other peoples take on this is and which you use.

  5. #5
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by rabbitsfeat View Post
    Sorry but it's probably just me but I don't quite understand the above sentence.

    I'm using xhtml transitional 1.0 and charset=utf-8.

    So with this should I just put quotes and emdashes in literally or use the character references.
    If you're using UTF-8, the best and easiest way is to use literal quote and dash characters if your editor allows a method for inputting them. If not, you should use numeric character references (NCR) like —, not character entity references like —, because the latter are not guaranteed to work with XHTML. (Some entity references can also cause problems in older browsers.)

    If you use pretend-XHTML (served as text/html) I strongly recommend decimal NCRs (e.g., —) instead of hexadecimal (e.g., —), since some older HTML-only browsers don't recognise hexadecimal NCRs.
    Birnam wood is come to Dunsinane


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
  •