Codec.Binary.PythonString
Description
Implementation of python escaping.
This implementation encodes non-printable characters (0x00-0x1f, 0x7f-0xff) to hex-value characters ('\xhh') while leaving printable characters as such:
> encode [0, 10, 13, 110] "\\x00\\x0A\\x0Dn" > putStrLn $ encode [0, 10, 13, 110] \x00\x0A\x0Dn
It also properly handles escaping of a few characters that require it:
> encode [34, 39, 92] "\\\"\\'\\\\" putStrLn $ encode [34, 39, 92] \"\'\\
Further documentation and information can be found at http://www.haskell.org/haskellwiki/Library/Data_encoding.
Documentation
encode :: [Word8] -> String
Encode data.
decode :: String -> Maybe [Word8]
Decode data (strict).
decode' :: String -> [Maybe Word8]
Arguments
:: Int | length of individual lines (values |
-> String | |
-> [String] |
Chop up a string in parts.
unchop :: [String] -> String
Concatenate the list of strings into one long string.