Skip to main content
Version: v0.0.4

Function: canonicalCharset()

canonicalCharset(raw): string

The canonical Table-0211 code for a label, for equality comparison (e.g. the MSH-18-vs-options.charset ENCODING_MISMATCH check). Synonyms collapse to one canonical string ("UNICODE UTF-8" and "UTF-8""UTF-8"), so a synonym pair does not raise a false mismatch; an unrecognized label returns its normalized form so two genuinely different labels still differ.

Parameters

raw

string

Returns

string

Example

import { canonicalCharset } from "@cosyte/hl7";
canonicalCharset("unicode utf-8") === canonicalCharset("UTF-8"); // true