[Haskell-cafe] [OBORONA-SPAM] Dealing with encodings

Danilov Alexander danilovalexalex at yandex.ru
Wed Aug 6 16:09:02 UTC 2014


06.08.2014 16:14, Dmitry Bogatov пишет:
> * Danilov Alexander <danilovalexalex at yandex.ru> [2014-08-06 09:25:54+0400]
>> 05.08.2014 16:00, Dmitry Bogatov пишет:
>>> Hello!
>>>
>>> How teach hxt to handle "KOI8-R" encoding of input file?
>>>
>>> And it seems that so many great packages (like hxt, feed, curl) uses String.
>>> Is it some work in progress to port them to Text?
>>> Prelude> :search encoding
>> Prelude> :search encoding
>> Searching for: encoding
>> package encoding
>> Data.Text.Encoding module Data.Text.Encoding
>> Data.Text.Lazy.Encoding module Data.Text.Lazy.Encoding
>> GHC.IO.Encoding module GHC.IO.Encoding
>> System.IO hGetEncoding :: Handle -> IO (Maybe TextEncoding)
>> GHC.IO.Handle hGetEncoding :: Handle -> IO (Maybe TextEncoding)
>> System.IO hSetEncoding :: Handle -> TextEncoding -> IO ()
>> GHC.IO.Handle hSetEncoding :: Handle -> TextEncoding -> IO ()
>> System.IO localeEncoding :: TextEncoding
>> GHC.IO.Encoding localeEncoding :: TextEncoding
>> System.IO mkTextEncoding :: String -> IO TextEncoding
>> GHC.IO.Encoding mkTextEncoding :: String -> IO TextEncoding
> Problem is that I have XML file from unknown source. I do not know
> encoding A-priori, it's specified in file itself. And to get it, I need
> to parse XML.
>
>
Usually, encoding specified in xml file, and xml parser may recode text data itself.
I show you API to recode text, it xml parser unable to recode.



More information about the Haskell-Cafe mailing list