Skip to content

Pre-R2007 code pages beyond 1251/1252, proven on real drawings (#370 follow-up) #375

Open

Description

@DrunkOnJava

Follow-up to #370 / #374.

#374 decodes pre-R2007 text in the code page named by the file header. Its table holds only the two pages that an AutoCAD export in the pinned corpus names:

Header short Page Drawings
29 ANSI_1251 14
30 ANSI_1252 2

Every other short reads as CodePage::Unknown and decodes as before. The spec (§3.2.5) says only "a raw short" and prints no table. No value was taken from another implementation (see CLEANROOM.md).

What is not proven

  • No real drawing tests the decoder. None of the 24 pre-R2007 drawings in the pinned corpus holds a string with a byte above 0x7F (0 of 9,076 strings). The 612/612 result in fix(entities): read pre-R2007 text in the code page the header names (§3.2.5, #370) #374 comes from examples/probe_code_page.rs rewriting strings in memory, so it proves the plumbing and the charts, not AutoCAD's bytes.
  • No pages beyond 1251 and 1252. Not covered: 1250 (Central European), 1253 (Greek), 1254 (Turkish), 1255 (Hebrew), 1256 (Arabic), 1257 (Baltic), 1258 (Vietnamese), 874 (Thai), 932 (Japanese), 936 (Simplified Chinese), 949 (Korean), 950 (Traditional Chinese), and the DOS and ISO pages. The double-byte pages (932, 936, 949, 950) also need checking for how MTEXT and other strings hold characters the page lacks.
  • R14 is assumed. Shorts 29 and 30 are applied to R14 from the later releases; no R14 export names them.
  • Writers still emit UTF-8. The page-aware inverse is owed (ARCHITECTURE.md §7ao).
  • XRECORD and XDATA strings are not decoded by page.

Done when

For each page added to the table, one public or AutoCAD-made pre-R2007 drawing whose header names that page, and whose AutoCAD DXF export agrees with our decode, is pinned or recorded as local evidence. For 1252, that means a real drawing with accented text in TEXT, MTEXT, layer, block and attribute strings, decoded equal to its export.

Sources to try

  • The AutoCAD trial (.git/train/AUTOCAD-TODO.md §4). On an English install it can make real 1252 drawings, and it can show how characters outside the page are stored. Other pages may need a different system locale.
  • Public archives of pre-2007 drawings from Japanese, Chinese, Korean, Greek and Central European sources, each with an AutoCAD DXF export.

Activity

  1. added
    type:bug
    area:string-stream
    priority:P2
    on Oct 27, 2026
  2. added a commit that references this issue on Oct 27, 2026
  3. DrunkOnJava commented on Oct 27, 2026

    @DrunkOnJava
    OwnerAuthor

    Research update (2026-10-27): about 1,350 GitHub repositories and about 100 open-data datasets were checked. Nothing is committed yet. The full tables are local to the maintainer's machine, outside the repository.

    The header short is an enum, not a Windows page number. Pre-R2007 drawings with a DXF export of the same drawing (matched by $FINGERPRINTGUID) map these shorts:

    Short Page Pre-R2007 evidence
    28 ANSI_1250 DXF twin
    29 ANSI_1251 DXF twin (already in #374)
    30 ANSI_1252 DXF twin, now including an AC1014 pair, so R14 is no longer only assumed
    32 cp1253 (Greek) Greek words as raw bytes in 11 pre-R2007 files; no twin
    33 ANSI_1254 DXF twin
    36 ANSI_1257 DXF twin
    38 ANSI_932 DXF twin; Shift-JIS text in AC1014 files
    39 ANSI_936 DXF twin; GBK text in AC1014/AC1018 files
    40 cp949 (Korean) Korean layout name as raw bytes in 5 AC1015 files; the name ANSI_949 appears only on AC1024+ twins
    41 ANSI_950 DXF twin, with 27 of 27 Big5 strings of the twin found in the DWG

    Caveats:

    • The DXF producers are unidentified. Six twin pairs disagree (header 30 but a DXF naming 932 or 950), so a twin counts only where the same application wrote both.
    • DWG strings are bit-aligned, not byte-aligned, so a raw byte search needs a 0 to 7 bit shift.

    Pin-able (permissive licence, fetched at run time, never committed):

    • kurema/BookViewerApp3: MIT, AC1014, short 38, レイアウト1.
    • Seeed-Studio/OSHW-Jetson-Series: Apache-2.0, AC1018, short 39, 布局1.
    • LilyGO T-Dongle-S3 and huifer/planar_algorithm.

    None of the pin-able files has both a DXF twin and non-ASCII text. Their proof is the localized layout-name constants, which a decode either reproduces or does not.

    Local evidence only (no or incompatible licence):

    • tbs-trappy/source_one: AC1018, short 41, with a Big5 twin.
    • Makeroni/Eye-of-Horus: AC1018, 1252 with Presentación1 and a twin.
    • The data.gov.gr Greek files: the licence is unconfirmed (CC BY 4.0 per data.europa.eu, "not specified" per the publisher).

    Not found: any pre-R2007 file for 1258, the DOS or ISO pages, or short 31. Shorts 35 (Arabic) and 37 (Thai) appear only on AC1032 files.

    The code-page lane picks this up next: table rows backed by these drawings, the pins, and real-file decodes of the layout-name constants.

  4. added
    release:R13
    release:R14
    release:R2000
    release:R2004
    on Oct 27, 2026
  5. DrunkOnJava commented on Oct 27, 2026

    @DrunkOnJava
    OwnerAuthor

    Status on main after 7f4d63c (2026-10-27):

    Done

    Still open here

    • Pages no measured drawing names: 1255, 1256, 1258, 874, and the DOS and ISO pages. A header short outside the table still decodes as lossy UTF-8.
    • R14 is still applied from the later releases: no R14 export in the corpus names a page.
    • No real 1252 drawing with accented text in TEXT, MTEXT, layer, block and attribute strings, decoded equal to its export. The AutoCAD trial (tools/autocad/, feat(tools): scripts and runbook for the AutoCAD trial (#119, #348, #375) #383) is the planned source.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:string-streampriority:P2release:R13release:R14release:R2000release:R2004type:bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions