{"id":27719,"library":"encutils","title":"encutils","description":"encutils is a Python utility library for encoding detection and conversion, providing simple functions to handle text encoding issues. Current version 1.0.0, released with Python >=3.10 support. Low release cadence.","status":"active","version":"1.0.0","language":"python","source_language":"en","source_url":"https://github.com/coherent-oss/encutils","tags":["encoding","detection","conversion","utility"],"install":[{"cmd":"pip install encutils","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"","wrong":"","symbol":"detect_encoding","correct":"from encutils import detect_encoding"},{"note":"","wrong":"","symbol":"convert_encoding","correct":"from encutils import convert_encoding"},{"note":"","wrong":"","symbol":"guess_encoding","correct":"from encutils import guess_encoding"}],"quickstart":{"code":"from encutils import detect_encoding, convert_encoding\n\ntext = b'Hello World'\nencoding = detect_encoding(text)\nprint('Detected encoding:', encoding)\n\nconverted = convert_encoding(text, 'utf-8')\nprint('Converted text:', converted.decode('utf-8'))","lang":"python","description":"Detect encoding of a byte string and convert to UTF-8."},"warnings":[{"fix":"Ensure input is bytes (e.g., my_str.encode('utf-8')) or bytes object.","message":"Input must be bytes, not str. Passing str will raise TypeError.","severity":"gotcha","affected_versions":"all"},{"fix":"Replace guess_encoding() with detect_encoding() for new code.","message":"The function guess_encoding is deprecated in favor of detect_encoding which provides more accurate detection.","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Encode string to bytes: text.encode('utf-8') or use b'...' literal.","cause":"Passing a string instead of bytes to detect_encoding or convert_encoding.","error":"TypeError: expected bytes-like object, not 'str'"},{"fix":"Provide longer input (at least 4 bytes) or try specifying encoding explicitly with convert_encoding(input, 'utf-8', fallback='latin-1').","cause":"Input is too short or has no recognizable encoding pattern.","error":"UnknownEncoding: No encoding detected for input"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}