Expand description
Specification-oriented DCE 3.0a / 3.01a / 3.02a and CDCE converters.
Unlike the legacy modules (cdce, dce3_0a, dce3_01a, unicode), which are
preserved to match old/libdce-2.51/ as closely as possible for comparison,
this module implements DCE wire codecs from docs/ and delegates document
conversion to shared APIs, with the limits documented below:
- DCE 3.0a (
3_0a,3_0a_raw,hex_3_0a,hex_3_0a_raw): Raw transport encodes and decodes all mapped short Dcs in0..=115(MAX_DCE_3_0A_SHORT_DC, i.e.0,1, and13..=115; short Dcs2..=12had no byte mappings in 3.0a and are logged as unmappable inFormatLogand omitted). - DCE 3.01a (
3_01a,3_01a_raw,hex_3_01a,hex_3_01a_raw): Raw transport encodes and decodes all allocated short Dcs in0..=199(MAX_DCE_3_01A_SHORT_DC), unlocking Base64 encapsulation (Dc 191..Dc 127..=190/Dc 195..Dc 192) for arbitrary UTF-8 and data. - DCE 3.02a (
3_02a,3_02a_raw,hex_3_02a,hex_3_02a_raw): Stubbed (returns an error when invoked). Allocates short Dcs0..=202(MAX_DCE_3_02A_SHORT_DC), adding keyed embed framing (Dc 200..=202) onCore:C9..=CB, but the 18 October 2013 specification left its version selector inDCE_Version_Selectorsand corresponding short Dc unassigned (marked as TBD;Dc 205isDCE Version Selector 3.03a, so position0x03is not used here to avoid colliding with 3.03a). - Corrected Base64 digit 34 (
Dc 161,'i') vs digit 8 (Dc 135,'I'): The upstream.odsspreadsheet auto-capitalized lowercase'i'to'I', corruptingBase64_to_DcandDc_to_Base64. - Corrected
Dc 113(End DCE content) mapping (Core:03): The upstreamDCE Character List by IDsheet had a typoCore:01instead ofCore:03. - Unicode conversion uses the shared modern equivalence and approximation resolver, including NEXT LINE for the historical newline character. Unmapped Unicode is preserved using UTF-8 encapsulation on capable targets.
The 3.02a version selector is left marked as TBD because its spreadsheet leaves
the selector unassigned and Dc 205 is allocated to DCE 3.03a. Explicit legacy
one-step and legacy HTML translators retain PHP-compatible behavior. Normal
HTML escapes shared Unicode text. See porting-notes.md for audit limits.
Enums§
- DceVersion
- DCE specification version.
Constants§
- MAX_
DCE_ 3_ 0A_ SHORT_ DC - Maximum short Dc allocated in DCE 3.0a (
0..=115). - MAX_
DCE_ 3_ 01A_ SHORT_ DC - Maximum short Dc allocated in DCE 3.01a (
0..=199). - MAX_
DCE_ 3_ 02A_ SHORT_ DC - Maximum short Dc allocated in DCE 3.02a (
0..=202).
Functions§
- base64_
char_ to_ short_ dc - Maps a standard Base64 ASCII byte (
A-Z,a-z,0-9,+,/,=) to its DCE 3.01a+ short Dc (127..=190,195). - dce_
convert - Converts between any
dceutils/ DCE / CDCE formats using the spec-compliant implementations (supporting DCE 3.0a0..=115, DCE 3.01a0..=199with Base64 encapsulation, DCE 3.02a0..=202, and general/legacy CDCE). - dce_
convert_ with_ log - Converts between any
dceutils/ DCE / CDCE formats using the spec-compliant implementations, returning the converted bytes andFormatLog. - dce_
convert_ with_ options - Converts formats with optional replacement-character recovery for damaged text, returning converted bytes and diagnostics.
- decode_
dc64_ to_ bytes - Decodes a slice of DCE 3.01a+ Base64 short Dcs (
127..=190,195) into raw bytes. - decode_
dce_ preserving_ controls - Decodes a DCE binary or hex-encoded stream (
dce,3_0a,3_0a_raw,3_01a,3_01a_raw,3_02a,3_02a_raw, and theirhex_*variants) into a sequence of short Dc IDs while preserving all stateful DCE control characters (13..=16,112..=115,194,196..=199,205) as-is. - decode_
dce_ preserving_ controls_ with_ options - Decodes DCE while retaining encoding controls and diagnosing recovery.
- encode_
bytes_ to_ dc64 - Encodes arbitrary bytes into DCE 3.01a+ Base64 short Dcs (
127..=190,195). - encode_
dce_ preserving_ controls - Encodes a sequence of short Dc IDs into a DCE binary or hex-encoded format
(
dce,3_0a,3_0a_raw,3_01a,3_01a_raw,3_02a,3_02a_raw, and theirhex_*variants), respecting any explicit DCE sheet/control Dcs already present indcsand automatically inserting sheet transitions or framing when absent. - encode_
utf8_ to_ dc64_ encapsulated - Encodes UTF-8 bytes into a DCE 3.01a+ Base64-encapsulated short Dc sequence
(
Dc 191, Base64 Dcs127..=190/195,Dc 192). - get_
dce_ version - Detects the DCE format version (
"3_0a"or"3_01a") ofdata. - get_
dce_ version_ with_ log - Detects the DCE format version (
"3_0a"or"3_01a") ofdata, recording any errors inlog. - is_
base64_ payload_ short_ dc - Returns
trueifshort_dcis a Base64 digit (127..=190) or padding (195). - is_
dce_ encoding_ control_ dc - Returns
trueifshort_dcis a DCE stateful-encoding control character or unbounded-content framing marker that has no glyph representation in text/CDCE. - select_
dce_ version_ for_ short_ dcs - Selects the minimum implemented
DceVersion(V3_0aorV3_01a) required to representdcs. - short_
dc_ to_ base64_ char - Maps a DCE 3.01a+ Base64 short Dc (
127..=190,195) to its standard Base64 character. - unicode_
codepoint_ to_ short_ dc - Selects a DCE short character with an exact shared Unicode equivalence.