Reputation: 491
Before POST-ing a form with text fields, I'm able to convert curly quotes from word into normal quotation marks with the following JavaScript snippet:
s = s.replace( /\u201c/g, '"' );
s = s.replace( /\u201d/g, '"' );
But I've recently encountered double opening/closing quotes as shown in brackets in the Question Title, does anyone know the unicode numbers for these?
Upvotes: 3
Views: 3755
Reputation: 65156
You could easily find this out for yourself, in JavaScript, by using charCodeAt
. You could even do it in the Firebug console:
>>> "”".charCodeAt(0).toString(16)
201d
To toString
call at the end even converts it to hexadecimal for you. Remember to pad it with zeros if it's shorted than 4 digits.
Upvotes: 3
Reputation: 11
HTML Escaped entities:
“ ”
Converted with this tool: http://u-n-i.co/de/
Upvotes: 1
Reputation: 536567
U+201C and U+201D are the Unicode characters “
and ”
! You should already be catching them.
If you want to also pick up the single-quote characters ‘
and ’
and convert them to '
, that would be U+2018 and U+2019.
However, this kind of replacement is a Unicode Smell. What are you trying to do here and why? ‚‘’„“”«»–—
etc are perfectly valid characters and if your app can't handle them it won't be able to handle other non-ASCII characters either, which would generally be considered a Bad Thing. If at all possible, it is better to fix whatever problem these characters are currently triggering, rather than sweep it under the rug with a replacement.
Upvotes: 7
Reputation: 12269
Your code looks correct for unicode:
for start quote : U+201C
for end quote : U+201D
Source: http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html
Upvotes: 1