FAILURE MAP
← Case archive

FA-2946 / Encodings / Open access

UTF-16 BOM is interpreted as ordinary text · case 01

UTF-16 BOM is interpreted as ordinary text.

Verified by executionVariant 1 · 4 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The implementation applies an operation whose text or grammar semantics violate this contract: Decode BOM-bearing UTF-16 hex data honoring the BOM.

VERIFIED REPAIR

Implement the complete stated contract, including the boundary fixtures: Decode BOM-bearing UTF-16 hex data honoring the BOM.

Unsuccessful approach: The attempted repair handles the primary example but still violates a separate boundary of the same contract.

Case contract

Decode BOM-bearing UTF-16 hex data honoring the BOM.

Why this case matters

A local executable model for consumers of structured text; oracle values are authored literals, not outputs copied from the repaired implementation.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return bytes.fromhex(x).decode('utf-16-le')
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve('fffe4100'), 'A')
check('boundary 2', solve('feff0041'), 'A')
check('boundary 3', solve('fffe3dd800de'), '😀')
check('boundary 4', solve('feff'), '')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
boundary 1AAFailed
boundary 2￾䄀AFailed
boundary 3😀😀Failed
boundary 4￾Failed

SHA-256 / 02dc52f2f10b90351d41de8af2c8bcfc65129f58f48653a980ae68cec721f42d

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return bytes.fromhex(x)[2:].decode('utf-16-le')
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve('fffe4100'), 'A')
check('boundary 2', solve('feff0041'), 'A')
check('boundary 3', solve('fffe3dd800de'), '😀')
check('boundary 4', solve('feff'), '')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
boundary 1AAPassed
boundary 2䄀AFailed
boundary 3😀😀Passed
boundary 4Passed

SHA-256 / 2fd223beccfb563af83617172550f00ab78e4e93cc5eaa709cbffc0a7a668de8

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return bytes.fromhex(x).decode('utf-16')
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve('fffe4100'), 'A')
check('boundary 2', solve('feff0041'), 'A')
check('boundary 3', solve('fffe3dd800de'), '😀')
check('boundary 4', solve('feff'), '')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
boundary 1AAPassed
boundary 2AAPassed
boundary 3😀😀Passed
boundary 4Passed

SHA-256 / cab4c8610b7ccfa75795fe97443e821ee4ad327ca6560c57c0f59c2c54cf202a

Verification & scope

This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:37:19.511710+00:00.

Case digest / 74d9258af93ad467ff49446d74f17a0dcdda832375fdcaa400237a9857ad63e8