dataenc-0.13.0.4: Data encoding library

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.

Synopsis

Documentation

encode :: [Word8] -> StringSource

Encode data.

decode :: String -> Maybe [Word8]Source

Decode data (strict).

chopSource

Arguments

:: Int

length of individual lines (values < 1 are ignored)

-> String 
-> [String] 

Chop up a string in parts.

unchop :: [String] -> StringSource

Concatenate the list of strings into one long string.