Sanitise text to ISO 20022 charset
sanitize_to_iso20022_charsetTransliterate accents and remove unsupported symbols from free-text fields to comply with the ISO 20022 Latin character set. Returns the cleaned value and indicates if the original was valid.
Instructions
Sanitise one free-text field to the ISO 20022 Latin character set.
Use this on a single free-text value (name, remittance info) to
transliterate accents and drop unsupported symbols before placing it in
a record, and to see whether the value changed. Operates on one string;
to check a whole batch's rulebook compliance use ``validate_payment_scheme``.
Wraps :func:`pain001.sanitize_to_charset`. Transliterates accents
(``é`` -> ``e``), removes unsupported symbols, and returns both
the cleaned string and a flag for whether the original was
already valid - useful for surfacing the change to the user
before writing it back to a record.
Args:
value: The text to sanitise.
Returns:
``{"value": str, "sanitised": str, "was_valid": bool, "changed": bool}``.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| value | Yes | A single free-text field value (e.g. a name or remittance line) to transliterate to the ISO 20022 Latin character set. |