Detection and conversion
Keep uncertain detection separate from explicit conversion.
Detect
POST /v1/text/detect returns encoding evidence without changing text.
{ "text": "မြန်မာစာ" }Possible encodings are unicode, zawgyi, mixed, unknown, and
non_myanmar. unknown is a legitimate answer for ambiguous shared sequences.
mixed means separate Myanmar runs have opposing evidence; a switch within one
uninterrupted run cannot be reliably located. Detection does not identify the
language or establish orthographic validity.
Convert
POST /v1/text/convert requires both from and to to be unicode or
zawgyi.
{ "text": "မဂၤလာပါ", "from": "zawgyi", "to": "unicode" }The output is မင်္ဂလာပါ. Equal directions produce an exact no-op. Do not pass
unknown or mixed as a known source encoding. Preserve original text and the
chosen direction. Unicode should be your canonical storage format.
Guard against mixed or mislabelled input
For pasted text, enable validateSource explicitly:
{
"text": "ေၾကညာစာတမ္း",
"from": "zawgyi",
"to": "unicode",
"validateSource": true
}Before a direction-changing conversion, this rejects mixed evidence
(encoding_mixed), evidence conflicting with from (encoding_mismatch), or
any uncertain Myanmar segment (encoding_uncertain). These are HTTP 400
problems, with no partial converted output. Use /v1/text/detect to inspect the
original text and segment offsets; do not repeatedly try both directions.
Omitting the flag or setting it to false keeps the original unchecked
behavior. Equal directions still return the input unchanged. The flag is a
conservative guard, not automatic mixed-text repair: detection can miss switches
inside one Myanmar run and cannot guarantee spelling or linguistic correctness.
Preserve the original and review uncertain input before deliberately opting out.
Unicode-to-Zawgyi is a compatibility operation, not a lossless representation of all Myanmar-script languages. Exact round trips are not promised. Conversion does not additionally apply the separate NFC operation.