03-26-2009, 05:43 PM | #1 |
Has got to the black veil
Posts: 542
Karma: 2144168
Join Date: Aug 2007
Location: Southeastern Pennsylvania
Device: Kobo Aura One, Kindle Paperwhite 2
|
Smart quotes in XHTML?
After some experimentation, I've determined that the easiest way (for me) to make an ePub book from plain text is to just mark it up myself. However, I can't figure out how to get "smart quotes" in an XHTML page and have it be valid. As far as I can tell, smart quotes aren't valid for XHTML, or at least I can't get any file that uses them to validate. It doesn't say why, just that it encountered an unexpected code or something like that. I took out the smart quotes and it validated just fine.
I've been unzipping ePub books to see how they work. I've found some that have the smart quotes. Are they just inserted and nobody worries if they don't validate? |
03-26-2009, 05:48 PM | #2 |
zeldinha zippy zeldissima
Posts: 27,827
Karma: 921169
Join Date: Dec 2007
Location: Paris, France
Device: eb1150 & is that a nook in her pocket, or she just happy to see you?
|
by "smart quotes" do you mean properly angled quotes ? in that case, try these codes :
double quotes : left “ right ” single : left ‘ right ’ angled quotes : left « right » for more html entities look at this reference table. |
03-26-2009, 06:02 PM | #3 | |
The Grand Mouse 高貴的老鼠
Posts: 71,510
Karma: 306214458
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Voyage
|
If you use a text editor that handles UTF-8 text, and specify the XHTML character set to be UTF-8 you can just include curly quotes and they'll verify OK. Otherwise you'll need to use the entities.
“ etc Quote:
|
|
03-26-2009, 08:34 PM | #4 |
Groupie
Posts: 170
Karma: 2000
Join Date: Apr 2008
Location: San José, CA
Device: Amazon Kindle 1, Sony PRS-300, Amazon Kindle 3
|
Or use the <q> tag and the stylesheet from this page: Language Specific Quotation Marks
|
03-26-2009, 08:36 PM | #5 | |
zeldinha zippy zeldissima
Posts: 27,827
Karma: 921169
Join Date: Dec 2007
Location: Paris, France
Device: eb1150 & is that a nook in her pocket, or she just happy to see you?
|
Quote:
|
|
03-26-2009, 10:09 PM | #6 |
Fanatic
Posts: 548
Karma: 2928497
Join Date: Mar 2008
Device: Clara 2E & Sage
|
I have had trouble with the named character entities not displaying correctlyin some situations. It is safer to use the numeric entities, which will always work:
Left double quote = “ Right double quote = ” Some text editors will allow you to enter the UTF-8 character, or the named entity and convert them to numeric on command. The named entities that are safe to use in all cases are: http://en.wikipedia.org/wiki/List_of...ntities_in_XML Last edited by jgray; 03-26-2009 at 10:14 PM. |
03-27-2009, 06:13 AM | #7 |
frumious Bandersnatch
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
The proper "smart quotes" (i.e., not just oriented quotation marks, but with the ability of detecting the language and quotation level) rely, as far as I know, on the ":before" and ":after" pseudo-classes and "content" property of CSS. I'm not sure these are supported in the ePUB specification, I believe they aren't.
Besides, there is still the "issue" with multi-paragraph quotes, I don't think it's possible to define how they should behave with CSS... So, I decided to forget about the "smartiness" and instead just use the proper character (or entity) in each place. |
03-27-2009, 12:41 PM | #8 |
Has got to the black veil
Posts: 542
Karma: 2144168
Join Date: Aug 2007
Location: Southeastern Pennsylvania
Device: Kobo Aura One, Kindle Paperwhite 2
|
I used named entities in HTML docs that I converted via Mobipocket Creator and they didn't work; just showed the code rather than the character. I ended up inserting smart quotes directly in the original HTML document. (And yes, by "smart quotes" I mean angled quotation marks, single and double--that's what they're called in Word.) I guess that's why I didn't think of it when making an XHTML document for ePub.
I did use UTF-8. I wonder why the pages didn't verify, then? The error didn't name them specifically, just said that there was a character it couldn't read. I assumed it was the quotation marks, because when I took them out there was no problem. I used the verifier on the w3.org site, uploading the document. I just used regular Notepad to make the files. I don't own a reader that can read ePub. Do most of the readers parse named entities properly? If so, I think that might be the way to go. When I'm coding regular HTML, I just use the straight quotes. But for something I'm going to read on a dedicated reader, it should be as book-like as possible, in my opinion, especially when trying to convert the paper fetishists! Thanks for the advice. |
03-27-2009, 01:40 PM | #9 | |||
frumious Bandersnatch
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Quote:
[quote](And yes, by "smart quotes" I mean angled quotation marks, single and double--that's what they're called in Word.) "Smart" in the smart quotes does not mean curled/angled quotes, but the ability (or whatever) of Word to properly guess which kind of quote mark (open or close) should be used when you just type " (straight quote mark). Quote:
Quote:
|
|||
03-27-2009, 03:53 PM | #10 | |
Grand Sorcerer
Posts: 11,470
Karma: 13095790
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2 & Air 2, iPhone 7
|
Quote:
Dale |
|
03-27-2009, 03:59 PM | #11 |
Reticulator of Tharn
Posts: 618
Karma: 400000
Join Date: Jan 2007
Location: EST
Device: Sony PRS-505
|
To be spec-correct when using named entities you need to declare one of the XHTML DTDs, which means that you cannot include any non-XHTML markup in the document (such as SVG or OPF namespace-case sections). These days there's no real reason to use entities anyway. Just use an editor which will allow you to insert the character directly and use an EPUB-valid Unicode encoding (UTF-8 or UTF-16).
|
03-28-2009, 05:08 PM | #12 |
Fanatic
Posts: 548
Karma: 2928497
Join Date: Mar 2008
Device: Clara 2E & Sage
|
It seems that the forum software is being too smart. My numeric entities got converted to quote characters. By now, everyone should know where to go to find a table of extended characters, so it doesn't matter.
I don't remember the exact circumstances, but I did have display problems when using either the UTF-8 characters themselves, or the named entities. I have never had a problem using the numeric entities. It may simply be a matter of the various reading softwares not following spec. |
03-28-2009, 05:53 PM | #13 | |
Groupie
Posts: 170
Karma: 2000
Join Date: Apr 2008
Location: San José, CA
Device: Amazon Kindle 1, Sony PRS-300, Amazon Kindle 3
|
Quote:
[And one of the biggest arguments from TeX users against XML/XHTML is the complete lack of compliance among programs, even among the major players - several people on these forums have commented that Adobe Digital Editions ePubs regularly do not pass epubcheck] |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Calibre and Smart Quotes | salasnet | Calibre | 9 | 09-27-2010 04:32 AM |
Smart Quotes | Toxaris | ePub | 2 | 05-31-2010 10:32 AM |
Removing smart quotes | horseyride | Workshop | 8 | 03-06-2008 12:08 PM |
BASIC program for smart quotes | Puffball | Workshop | 4 | 01-24-2007 09:43 AM |
Smart quotes in RTF? | ogghead | Sony Reader | 8 | 01-23-2007 06:38 PM |