MCPcopy
hub / github.com/rspeer/python-ftfy / fix_encoding

Function fix_encoding

ftfy/__init__.py:586–602  ·  view source on GitHub ↗

Apply just the encoding-fixing steps of ftfy to this text. Returns the fixed text, discarding the explanation. >>> fix_encoding("ó") 'ó' >>> fix_encoding("ó") 'ó'

(
    text: str, config: TextFixerConfig | None = None, **kwargs: Any
)

Source from the content-addressed store, hash-verified

584
585
586def fix_encoding(
587 text: str, config: TextFixerConfig | None = None, **kwargs: Any
588) -> str:
589 """
590 Apply just the encoding-fixing steps of ftfy to this text. Returns the
591 fixed text, discarding the explanation.
592
593 >>> fix_encoding("ó")
594 'ó'
595 >>> fix_encoding("ó")
596 'ó'
597 """
598 if config is None:
599 config = TextFixerConfig(explain=False)
600 config = _config_from_kwargs(config, kwargs)
601 fixed, _explan = fix_encoding_and_explain(text, config)
602 return fixed
603
604
605# Some alternate names for the main functions

Callers 1

fix_and_explainFunction · 0.70

Calls 3

TextFixerConfigClass · 0.85
_config_from_kwargsFunction · 0.85
fix_encoding_and_explainFunction · 0.70

Tested by

no test coverage detected