UPDATE: The problem described in this answer has been corrected in heist
version 0.13.0.2.
The source code for yieldRuntimeText
is:
yieldRuntimeText :: Monad n => RuntimeSplice n Text -> DList (Chunk n)
yieldRuntimeText = yieldRuntime . liftM fromText
From what module comes that fromText
function? In the import section we find:
import Blaze.ByteString.Builder
import Blaze.ByteString.Builder.Char8
The documentation for the latter package says:
Note: This package is intended for low-level use like implementing protocols. If you need to serialize Unicode characters use one of the UTF encodings (e.g. 'Blaze.ByteString.Builder.Char.UTF-8').
and also:
fromText :: Text -> BuilderSource
O(n). Serialize the lower 8-bits of all characters in the strict text.
Mmmmm so maybe the problem is that the encoding from Text to Builder is not being done in UTF-8? Try defining your own version of yieldRuntimeText, with exactly the same code but using the following imports instead:
import Blaze.ByteString.Builder
import Blaze.ByteString.Builder.Char.Utf8
yieldRuntimeTextUtf8 :: Monad n => RuntimeSplice n Text -> DList (Chunk n)
yieldRuntimeTextUtf8 = yieldRuntime . liftM fromText