Open clojurians-org opened 5 years ago
Mmm, maybe the error is caused by Data.ByteString.Lazy.Char8.unpack
, it only handles valid ascii chars, right?
Maybe you can use Data.ByteString.UTF8.toString
from utf8-string
package instead?
it's still the same. it run success on my mac, but it fail on readhat7. maybe the system encoding have impact on it. but add show method can success.
import qualified Data.Aeson as J (encode)
import Data.ByteString.Lazy.Char8 as BLC (unpack)
import Data.Map (Map, singleton)
import Data.ByteString.Lazy.UTF8 as BLU (toString)
let jsonValue = "id" =: "140502198811102244"
<> "cell" =: "13986671110"
<> "name" =: "罗浩"
<> "meal" =: "Execution"
let jsonData = BLU.toString $ J.encode jsonValue
putStrLn (show jsonData)
putStrLn jsonData
it's very strange, the first print with show is success, but the second fail!