Should a period be placed within quotation marks if it would conflict with a punctuated item that should be used or typed verbatim?
Gee whiz! Just when I thought I had the "period within quotation marks" rules set firmly in my personal punctuational code, I hit upon this sentence:
All message IDs are pre-pended with the value “ID:”.
As a reviewer, should I advise my author to stuff that very American period inside the quotation mark? Wouldn't that not only look rather ugly but also somewhat confuse the fact that the item within the quotation marks is to be typed verbatim by the reader? What would be community-advised in this case?
Solution 1:
It's certainly a tricky question—the Chicago Manual of Style, for example, has no general guidance that I could find as to the appropriate format when following the American convention. It does offer an exception in section 7.75, which according to the section title, applies only to things that are to be literally typed, but I believe your example is close enough to apply the same rule.
If quotation marks must be used, any punctuation that is not part of the quoted expression should appear outside the quotation marks (as in the second example; see also 6.9)
Furthermore, Wikipedia does have this to offer:
Many American style guides explicitly permit periods and commas outside the quotation marks when the presence of the punctuation mark inside the quotation marks will lead to ambiguity, such as when describing keyboard input:
To use a long dash on Wikipedia, type in “—”.
Since, as you say, including the period inside the comma would be confusing, you should probably place the period outside the quotation marks.
Personally, I'd recommend using British style (aka logical punctuation), since by virtue of attempting to be logical, it ends up much easier than American style.
Solution 2:
Yes, the Chicago Manual of Style does indicate that the period can go outside the quote marks in order to avoid confusion. However, a quick rewrite solves the problem neatly:
The value “ID:” pre-pends all message IDs.
Commonly, with editorial problems, rewriting to avoid a problem gives a better result than ferreting out an obscure rule that, while in accord with a style guide, would still look suspicious or odd to a reader.
In other words, rewording to avoid difficult punctuation issues isn't a trick, or a shortcut, or an admission of guilt - it's standard editorial practice.
Solution 3:
Keep it as-is. The rule for putting sentence-final punctuation inside the quotation mark is mostly meant for actual quotations. In your case, the quote is in fact a verbatim string of characters, and putting the period inside the quotes would change its meaning. The usual rules for placement of quotation marks do not apply in this scenario.