Read a delivery receipt's body as the octets that arrived (#81)
* Regression tests for a receipt body read under a data_coding it is not written in * Read a delivery receipt's body as the octets that arrived, not by its data_coding * Assert SMPPSim's UCS2 receipt body parses like every other segment's * Record the receipt-body defect as fixed * Retain a multipart segment's octets once, not twice * Sort the new type import into its file's order
This commit is contained in:
+5
-4
@@ -1,7 +1,8 @@
|
||||
import type { Result } from './result.ts';
|
||||
import type { EncodingName } from './defs/encodings.ts';
|
||||
import { hasUdh } from './defs/constants.ts';
|
||||
import { detect, encodingByDataCoding, encodings } from './defs/encodings.ts';
|
||||
import { hasUdh } from './defs/constants.ts';
|
||||
import { udhLength } from './udh.ts';
|
||||
|
||||
/** A single SMS carries 1120 bits, whatever the alphabet. */
|
||||
const singleMessageBits = 1120;
|
||||
@@ -37,11 +38,11 @@ export function decodeMessage(
|
||||
return { message: encodings[encoding].decode(buffer), udh: undefined };
|
||||
}
|
||||
|
||||
const udhLength = (buffer[0] ?? 0) + 1;
|
||||
const headerLength = udhLength(buffer);
|
||||
|
||||
return {
|
||||
message: encodings[encoding].decode(buffer.subarray(udhLength)),
|
||||
udh: buffer.subarray(0, udhLength),
|
||||
message: encodings[encoding].decode(buffer.subarray(headerLength)),
|
||||
udh: buffer.subarray(0, headerLength),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user