based/src/Encoding/Yenc.hs

21 lines
488 B
Haskell
Raw Normal View History

module Encoding.Yenc
( ency
, decy
) where
import Data.ByteString.UTF8 as BSU -- from utf8-string
import qualified Data.ByteString.Char8 as C
import qualified Codec.Binary.Yenc as Y
decy :: String -> String
-- decy = C.unpack . U.fromRight . Y.decode . BSU.fromString
decy input =
case Y.decode (BSU.fromString input) of
Right decoded -> C.unpack decoded
Left _ -> "Error decoding Y.\n"
ency :: String -> String
ency = C.unpack . Y.encode . BSU.fromString