HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduletext-icu-0.8.0.5Haskell98

Data.Text.ICU.CharsetDetection

Access to the Unicode Character Set Detection facilities, implemented in the International Components for Unicode (ICU) libraries.

For more information see the "Character Set Detection" chapter in the ICU User Guide http://userguide.icu-project.org/conversion/detection.

  • 2 types
  • 8 values
  • Packagetext-icu-0.8.0.5
  • Exports10
  • LanguageHaskell98
  • LicenceBSD-3-Clause
  • SourceCharsetDetection.hsc
valuesetText :: ByteString -> CharsetDetector -> IO ()
#

From the ICU C API documentation: "Character set detection is at best an imprecise operation. The detection process will attempt to identify the charset that best matches the characteristics of the byte data, but the process is partly statistical in nature, and the results can not be guaranteed to always be correct.

For best accuracy in charset detection, the input data should be primarily in a single language, and a minimum of a few hundred bytes worth of plain text in the language are needed. The detection process will attempt to ignore html or xml style markup that could otherwise obscure the content."

Use the first 512 bytes, if available, as the text in the CharsetDetector object. This function is low-level and used by the more high-level detect function.

datadata CharsetMatch
#

Opaque character set match handle. The memory backing these objects is managed entirely by the ICU C library. TODO: UCharsetMatch is reset after the setText call. We need to handle it.

datadata CharsetDetector
#

Handy wrapper for the pointer to the UCharsetDetector. We must always call ucsdet_close on any UCharsetDetector when we are done. The withCharsetDetector and wrapUCharsetDetector functions simplify management of the pointers.