Advertisement
Data Processing

The Fullwidth Trap: Two-Thirds of Correct Numbers Rejected for Being the Wrong Width

The numbers were right. That is the uncomfortable starting point of this test. Nine hundred numeric strings went through a strict ASCII validation...

The numbers were right. That is the uncomfortable starting point of this test. Nine hundred numeric strings went through a strict ASCII validation check, and six hundred of them were rejected — not because any digit was wrong, not because any value was out of range, but because the digits were drawn too wide. The rejected strings were fullwidth characters, the forms produced routinely by East Asian input methods, spreadsheets and document exports, in which a digit looks like a digit, reads like a digit, and means exactly the same number, yet occupies a different Unicode code point from the ASCII digit a validator expects. The values survived. The characters did not.

What The Fullwidth Trap means

The Fullwidth Trap means a validation failure in which numerically correct data is rejected purely because its characters are fullwidth rather than halfwidth forms. Fullwidth digits and punctuation are compatibility characters: they render wider, matching the square cell of an East Asian character grid, but they encode the same digits and the same separators. A human reader scanning a file sees "12,345" three times and sees no difference worth naming. A strict pattern matcher sees three different strings, only one of which is written in the characters it was built to accept. The trap is that the failure looks, in every log and error report, like bad data — malformed numbers, invalid format — when the data layer is innocent and only the character layer differs. Diagnosis then chases the wrong layer: teams audit the source system, question the export, and re-check the values, while the actual cause sits in an encoding detail that no value-level check will ever find.

Three writings of the same integers

The test file held 900 numeric strings built from the same set of integers, written three ways, 300 strings each. The first group wrote each value in ordinary halfwidth form, the familiar "12,345" style: ASCII digits, an ASCII comma as the thousands separator, exactly as a Western keyboard produces it. The second group wrote the same values in fullwidth form throughout: fullwidth digits and a fullwidth separator, the output an East Asian input method produces when it is in fullwidth mode. The third group mixed the two: fullwidth digits with a halfwidth separator, the hybrid that appears when sources are merged or when an input method switches mode mid-file. No group contained a wrong number. Every string in the file, read by a person, stated a correct integer from the same underlying set.

Against that file stood a single strict validation rule: an ASCII-only regular expression, ^[0-9][0-9,]*(\.[0-9]+)?$, requiring a full match. The pattern is not exotic or careless — it is the shape of numeric check that appears in import scripts everywhere, written by someone who pictured digits and commas and encoded exactly that picture. The rule accepted 300 of the 900 strings, 33.3 percent of the file. Every acceptance came from the halfwidth group, which passed 300 of 300. The fullwidth group passed 0 of 300. The mixed group also passed 0 of 300 (Source: SmartDataAI import test V1, run 2026-11-23; script and result JSON filed with this batch's evidence pack). Two-thirds of a numerically perfect file was turned away at the gate, and the split was not gradual or partial: it was total, group by group, decided entirely by character width.

The mixed group's clean sweep of rejections deserves a pause, because it rules out the comforting explanation that only exotic, fully foreign files are at risk. A mixed string is mostly ordinary: its separator is the standard ASCII comma, and only its digits are fullwidth. It still scored zero. The pattern does not grade on resemblance; a single character class mismatch anywhere in the string fails the whole match, so a file that is ninety percent conventional in appearance can be one hundred percent rejected in fact. Real-world files are far more likely to be mixed than purely fullwidth — a column pasted from one system into another, a spreadsheet touched by two editors in two locales — and the test shows the mixed case is not a partial-credit case. It is a total-loss case, indistinguishable in outcome from the fully fullwidth file.

Then the same file was run through one additional step: Unicode NFKC normalisation, the standard compatibility normalisation that folds fullwidth characters onto their halfwidth equivalents, followed by the identical strict validation rule, unchanged. The result was 900 of 900, 100 percent acceptance (Source: SmartDataAI import test V1, run 2026-11-23; script and result JSON filed with this batch's evidence pack). Nothing else was altered — not the pattern, not the values, not the file's structure. A single normalisation pass, applied before validation rather than after rejection, moved the acceptance rate from 33.3 percent to 100 percent. That swing is the cleanest evidence of where the fault lived: if the data had been wrong, normalisation could not have fixed it, because normalisation does not change values. It only changes widths, and width was the whole problem.

The practical sequence in most pipelines runs the other way. Validation is placed first, as the gatekeeper, and normalisation — if it exists at all — is placed later, as a cosmetic step applied to data that has already been admitted. Data rejected at the gate never reaches the step that would have saved it. The trap is therefore an ordering bug as much as an encoding bug: the two operations are both present in many codebases, but in the wrong order, and the order silently decides whether two-thirds of a correct file survives its own import.

The Fullwidth Trap: Two-Thirds of Correct Numbers Rejected for Being the Wrong Width

How this was measured

The values in this test were synthetic, generated by the test script itself: one set of integers was produced under a fixed seed of 42 and then rendered into the three written forms described above, 300 strings per form, so that the underlying numbers were held identical across groups by construction. The validation pattern and the NFKC normalisation step were fixed in advance, and the parsing and checking were carried out by the script's own deterministic logic, applied uniformly to all 900 strings before and after normalisation. The counts are stated exactly as constructed: 900 strings, three forms, one pattern, one normalisation pass. This exercise measures the behaviour of a strict ASCII pattern against constructed character forms; nothing here rates a commercial product, and no vendor's import tool was put through this test.

Questions, answered

Were any of the rejected numbers actually wrong? No. All three groups were written from the same set of integers, so every rejected string stated a correct value. The rejections were caused entirely by character width — fullwidth digits or separators where the ASCII-only pattern expected halfwidth characters — which is why the failure belongs to the validation layer, not the data layer.

Why did the mixed group fail completely instead of partially? Because the pattern requires a full match against ASCII character classes. A mixed string pairs fullwidth digits with a halfwidth separator, and the fullwidth digits alone are enough to fail the match. Resemblance does not earn partial credit: the mixed group scored 0 of 300, exactly like the fully fullwidth group.

What fixed the file, and what does that prove? NFKC normalisation, applied before the same unchanged pattern, raised acceptance from 300 of 900 to 900 of 900. Since normalisation changes character forms without changing values, the recovery proves the values were never the problem. The fix also has to come first: normalisation placed after validation never sees the rows validation already rejected.

Summary

Nine hundred correct numbers, written three ways, met one strict ASCII pattern: the halfwidth group passed completely, the fullwidth and mixed groups were rejected completely, and total acceptance was 33.3 percent. One NFKC normalisation pass before validation restored acceptance to 100 percent without changing a single value. The Fullwidth Trap is a layering error made visible — the rejection happens at the character layer, gets reported as a data failure, and is cured by an ordering change, not by fixing any number.

Sources

Know someone who needs this? Share it.

Advertisement