git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Some handling of non-valid UTF16
commite88e7ed0ef0b1c6996e295e0e72487026e30982e authorAndy Arvanitis <andyarvanitis@gmail.com> dateFri 17 Aug 2018, 21:42 (8 years ago) parent97ef1f0
1 file changed+2
src/CodeGen/Cpp/Printer.hs+2
src/CodeGen/Cpp/Printer.hs+2
@@ -400,6 +400,7 @@ stringLiteral pss | Just s <- decodeString pss =
400400 stringLiteral' :: Text -> Text
401401 stringLiteral' s = "\"" <> T.concatMap encodeChar s <> "\""
402402 encodeChar :: Char -> Text
403+ encodeChar '\0' = "\\0"
403404 encodeChar '\b' = "\\b"
404405 encodeChar '\t' = "\\t"
405406 encodeChar '\n' = "\\n"
@@ -409,6 +410,7 @@ stringLiteral pss | Just s <- decodeString pss =
409410 encodeChar '"' = "\\\""
410411 encodeChar '\\' = "\\\\"
411412 encodeChar c = T.singleton $ c
413+stringLiteral _ = "\"\\uFFFD\""
412414
413415unbox :: Text -> AST -> Text
414416unbox _ v@(NumericLiteral{}) = prettyPrintCpp1 v