h$      Safe-Inferredv Safe-Inferred& with-utf8+What to do with the encoding of the handle.We return new encoding as string to simplify testing, because, it turns out, when you make an encoding with some name, the resulting encoding can have a different name.The second constructor also contains the old encoding as a proof that the encoding is set to a new one only if there was a previous one in the first place. You probably think I am crazy, but I am not, it is just the simplest way to make the hSetBestUtf8Enc easy to write. with-utf8 Do nothing. with-utf8(Change the first encoding to the second. with-utf8Pure version of .This function is not actually used in the library. It exists only for documentation purposes to demonstrate the logic. It is also used in tests to verify that the logic implemented is indeed this. with-utf8+Choose the best encoding for a file handle.+This function implements the same logic as , but in a way that is more optimal in terms of IO queries. In particular: It receives both a handle and its current encoding, because the calling function will, most likely, need to know the current encoding (e.g. to be able to restore it), so we avoid repeating the query.It first checks for the cases where it doesn't care whether the device is a terminal or not, so the query will be made only if really necessary. with-utf8Is a terminal device? with-utf8Previous encoding name. with-utf8Handle to choose encoding for. with-utf8hIsTerminalDevice. with-utf8Current encoding. Safe-Inferred E with-utf8)Set handle encoding to the best possible.See , for description and prefer it, if possible. with-utf85Temporarily set handle encoding to the best possible.@Best possible@ means UTF-8, unless the handle points to a terminal device, in which case the encoding will be left the same, but tweaked to approximate unencodable characters.This function is safe to call on handles open in binary mode and it will do nothing on them. To sum up:,If the handle is in binary mode, do nothing.4If the handle points to a terminal device, act like .1For regular files always choose UTF-8, of course. with-utf8(Make a handle safe to write any text to.See , for description and prefer it, if possible. with-utf84Temporarily make a handle safe to write any text to.If the handle is not using UTF-8, adjust the encoding to remain the same as before, but approximate unencodable characters. When the action is done, restore it back to the previous one.Use this function only if you are sure you want to treat this handle as a terminal (that is, you will be using it to interact with the user and to write user-visible messages, rather than something that can be reasonably expected to go to a file).This function is safe to call on handles open in binary mode and it will do nothing on them.  with-utf8Like , but sets the file encoding to UTF-8, regardless of the current locale.  with-utf8Like  , but sets the file encoding to UTF-8, regardless of the current locale.   Safe-Inferred  with-utf8Make standard handles safe to write anything to them and change program-global default file handle encoding to UTF-8.This function will: Adjust the encoding of , , and ' to enable transliteration, like   does.Call = to change the program-global locale encoding to UTF-8.1Undo everything when the wrapped action finishes.  with-utf85Make standard handles safe to write anything to them.This function will for each of , ,  do: Tweak the existing encoding so that unrepresentable characters will get approximated (aka transliterated) by visually similar ones or question marks.?Restore the original encoding when the wrapped action finishes.Use this function only if you do not want to change the program-global locale encoding. Otherwise prefer  .   Safe-Inferred  with-utf8Like readFile, but assumes the file is encoded in UTF-8, regardless of the current locale. with-utf8Like  writeFile, but encodes the data in UTF-8, regardless of the current locale.   Safe-Inferred with-utf8Like , but assumes the file is encoded in UTF-8, regardless of the current locale. with-utf8Like , but encodes the data in UTF-8, regardless of the current locale.      ! " #$%&'&'('with-utf8-1.0.2.2-ajw536FxkhD9sJR9trQtoSystem.IO.Utf8.InternalSystem.IO.Utf8 Main.Utf8Data.Text.Lazy.IO.Utf8Data.Text.IO.Utf8Paths_with_utf8 System.IOopenFilewithFileEncodingActionKeep ChangeFromTochooseBestEncPure chooseBestEncsetHandleEncoding withHandlesetTerminalHandleEncodingwithTerminalHandlewithUtf8withStdTerminalHandlesreadFile writeFileversion getBinDir getLibDir getDynLibDir getDataDir getLibexecDir getSysconfDirgetDataFileNamebaseGHC.IO.Handle.FDstdinstdoutstderrGHC.IO.EncodingsetLocaleEncoding text-1.2.3.2 Data.Text.IO