Refuse a body the PDU's own data_coding cannot carry (#98)
* Regression tests for a body the PDU's own data_coding cannot carry * Refuse a body the PDU's own data_coding cannot carry, in the codec both send paths build through * Record the codec's body refusal, and drop two todo entries it and the interop run close * Regression tests for the aliased body TLV and the data_coding short_message settles * Find the body TLV by tag id, leave data_coding to the field that will be read, and correct the record * Record the two architecture findings this change does not close * Regression tests for a duplicated body tag and a short_message the wire never carries * Resolve every body TLV against the field that will be read, and move TLV writing to its table * Regression tests for a body only the TLV carries and an empty short_message * Let only octets the command writes settle the alphabet, and stop shadowing the TLV table
This commit is contained in:
@@ -123,6 +123,13 @@ export function detect(value: string): EncodingName {
|
||||
|
||||
export type Unencodable = { char: string; index: number };
|
||||
|
||||
/** What an alphabet could not carry, said the one way: the character, its code point and its index. */
|
||||
export function unencodableText(at: Unencodable): string {
|
||||
const point = (at.char.codePointAt(0) ?? 0).toString(16).toUpperCase().padStart(4, '0');
|
||||
|
||||
return `${JSON.stringify(at.char)} (U+${point}) at index ${String(at.index)}`;
|
||||
}
|
||||
|
||||
/** The first character `encoding` cannot carry, or undefined where it carries every one of them. */
|
||||
export function unencodable(message: string, encoding: EncodingName): Unencodable | undefined {
|
||||
const codec = encodings[encoding];
|
||||
|
||||
Reference in New Issue
Block a user