I am working on a package that makes an API call and gets strings with improperly oriented curly quotes, e. g.,
The word ’syneresis’ comes from Greek roots meaning ’take’ and ’together’.
Is there a clean builtin way (function I could call) to fix issues like this?
Edit: Example
(fix-quotes "’syneresis’ comes from Greek roots meaning ’take’")
=> ‘syneresis’ comes from Greek roots meaning ‘take’
Which looks like this:
‘syneresis’ comes from Greek roots meaning ‘take’
See here for curly quotes reference. Note that in the original string we only had ending quotes.
Edit: Picture
Here is a picture that may make it more clear,
The top text has the improperly oriented quote mark because it is the right quote (punctuation that denotes the end of a quotation). We need the properly oriented quote mark which is the left quote
(punctuation that denotes the start of a quotation). Imagine <,>
are quote marks, the input is >take>
and we want <take>
.
C-u C-x =
on these to find out what code points they correspond to? Please add this information to your question.