Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Commit

Permalink
Fix UTF8 encoding more multi byte encoding (continuation byte)
Browse files Browse the repository at this point in the history
fix #35 -- issue found by Andri Möll
  • Loading branch information
vincenthz committed Mar 24, 2020
1 parent f77c602 commit f2facd0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion stack.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# ~*~ auto-generated by haskell-ci with config : acd425cd61984b281e076f791e485a5cf28891a29d476fce3b6faa7e08deaeed ~*~
{ resolver: nightly-2019-09-29, packages: [ encoding, parse, types ], extra-deps: [], flags: {} }
{ resolver: lts-15.5, packages: [ encoding, parse, types ], extra-deps: [], flags: {} }

2 changes: 1 addition & 1 deletion types/Data/ASN1/Types/String.hs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ encodeUTF8 s = B.pack $ concatMap (toUTF8 . fromEnum) s
, toCont (e `shiftR` 6)
, toCont e]
| otherwise = error "not a valid value"
toCont v = fromIntegral (0xc0 .&. (v .&. 0x3f))
toCont v = fromIntegral (0x80 .|. (v .&. 0x3f))

decodeASCII :: ByteString -> String
decodeASCII = BC.unpack
Expand Down

0 comments on commit f2facd0

Please sign in to comment.