Expand description
LLM-assisted port of dceutils. Note that most of this is a direct port of the PHP implementation and it attempts to preserve its bugs and incompleteness as-is. The converter.rs module is a newly created alternative that attempts to be more complete and correct. The DCE 3.02a format isn’t technically implementable because it doesn’t define a version selector for that version; as implemented here it uses the byte assignment where a version selector ought to have gone.
Format support and notes:
| Format | Format code | Read | Write — Notes |
|---|---|---|---|
| CDCE-based formats: | |||
| CDCE | cdce | ||
| CDCE (legacy)1 | legacy_cdce | X | X |
| CDCE (legacy, strict)2 | cdce_lstrict | X | N/A |
| Generic DCE formats (automatic version selection): | |||
| DCE3 | dce | X | X |
| DCE (hex-encoded) | hex_dce | X | X |
| DCE 3.0a-based formats: | |||
| DCE 3.0a4 | 3_0a | X | X |
| DCE 3.0a (raw) | dce_3_0a_raw | X | X |
| DCE 3.0a (hex-encoded)4 | hex_3_0a | X | X |
| DCE 3.0a (raw hex-encoded) | hex_3_0a_raw | X | X |
| DCE 3.0a (old translator)5 | 3_0a_old | (X) | N/A (No tests) |
| dce2txt6 | dce2txt | (X) | N/A (No tests) |
| dce2hex6 | dce2hex | (X) | N/A (No tests) |
| hex2dce6 | hex2dce | (X) | N/A (No tests) |
| DCE 3.01a-based formats: | |||
| DCE 3.01a4,7 | 3_01a | (X) | (X) |
| DCE 3.01a (raw) | dce_3_01a_raw | (X) | |
| DCE 3.01a (hex-encoded)4,7 | hex_3_01a | (X) | (X) |
| DCE 3.01a (raw hex-encoded) | hex_3_01a_raw | (X) | |
| Miscellaneous DCE formats: | |||
| Dc ID list (ASCII)1 | dc | X | X |
| Unicode: | |||
| UTF-81 | utf8 | X | X |
| UTF-321 | utf32 | X | X |
| UTF-8 (Base64-encoded) | utf8_base64 | X | X |
| UTF-8 (Base64-encoded, ASCII Dc ID list) | utf8_dc64 | X | X |
| UTF-8 (Base64-encoded, ASCII Dc ID list; with headers) | utf8_dc64_enc | X | X |
| UTF-8 (Base64-encoded, DCE 3.01a+ encoding) | utf8_dc64_bin | X | X |
| UTF-8 (Base64-encoded, DCE 3.01a+ encoding; hex-encoded) | utf8_dc64_bin_hex | X | X |
| UTF-8 (Base64-encoded, DCE 3.01a+ encoding; with headers) | utf8_dc64_bin_enc | X | X |
| UTF-8 (Base64-encoded, DCE 3.01a+ encoding; with headers; hex-encoded) | utf8_dc64_bin_enc_hex | X | X |
| HTML: | |||
| HTML | html | ||
| HTML (snippet) | html_snippet | ||
| HTML (legacy CDCE output)7 | html_l | (X) | |
| HTML (snippet) (legacy CDCE output)7 | html_snippet_l | (X) |
Reading/writing these formats may not be lossless with DCE 3.0a. ↩ 1 2 3 4
Note that
cdce_lstrictis not actually a separate format fromlegacy_cdce; rather, it is an alias oflegacy_cdcethat instructs the parser to halt upon reaching an incorrectly structured CDCE sequence (by default it will attempt to recover from the error). ↩Automatically detects DCE version when reading, and writes to the latest DCE version that is well supported. ↩
Since this is a DCE format, simply enter DCE as the format when reading. Note that writing to old versions of DCE may not be lossless. ↩ 1 2 3 4
This is an early version of the DCE 3.0a translator, not a separate format. Leave the output format blank when using this translator, since the same code handles both input and output. This is not tested or maintained, and may or may not work properly. ↩
These are miscellaneous outdated translators, not separate formats. Leave the output format blank when using them, since the same code handles both input and output. These are not tested or maintained, and may or may not work properly. ↩ 1 2 3
It’ll try but it probably won’t work or won’t work well. Note that the HTML translators only work with legacy CDCE input and are very buggy (alpha quality). ↩ 1 2 3 4
Re-exports§
pub use converter::DceVersion;pub use converter::MAX_DCE_3_0A_SHORT_DC;pub use converter::MAX_DCE_3_01A_SHORT_DC;pub use converter::MAX_DCE_3_02A_SHORT_DC;pub use converter::decode_dce_preserving_controls;pub use converter::encode_dce_preserving_controls;pub use converter::is_dce_encoding_control_dc;pub use converter::dce_convert as dce_convert_new;pub use converter::dce_convert_with_log as dce_convert_new_with_log;pub use converter::dce_convert_with_options as dce_convert_new_with_options;
Modules§
- cdce
- CDCE character set decoder and data conversion utilities.
- cli
- CLI execution helpers for DCE utilities.
- converter
- Specification-oriented DCE 3.0a / 3.01a / 3.02a and CDCE converters.
- dce3_0a
- DCE 3.0a specification character set and codepage conversion.
- dce3_
01a - DCE 3.01a specification character set and codepage conversion.
- document
- Conversion between
dceutilsformats (CdceLegacy,Dce,Dce_3_0a,Dce_3_01a, etc.) andDcMstring. - legacy
- Legacy character encodings and fallback translation tables.
- tables
- Character translation tables and lookup indices for DCE formats.
- to_csv
- Utilities for processing and parsing DCE data files.
- tools
- Transformation and inspection helper tools for DCE data.
- unicode
- DCE document format to Unicode mapping and normalized sequence conversions.