In an ongoing project, we are inserting multibyte text into a buffer and experiencing strange behavior. When the question is first viewed, we receive something like:
Quote Environment à la Strunk\341\200\231s \342\200\230The Elements of Style\342\200\231
which, obviously, should be
Quote Environment à la Strunk’s ‘The Elements of Style’
Note the special quotes; reference question here. Interestingly, using
(set-buffer-multibyte nil)
(set-buffer-multibyte t)
in succession will fix the issue. Note not one or the other, but both in this order. What is going on here? It's interesting to note that à
is correctly displayed.
Shameless plug: that ongoing project posted this question.
string-as-unibyte
andstring-as-multibyte
are never the right answer. Their existence is actually a nuisance more than anything since it encourages people to have misconceived notions about "multibyte".string-as-unibyte
is the culprit. As I understand the underlying function, it has no side-effects. It is the content portion of(buffer-string)
of aurl
response buffer.