Skip to content

Kernel forms: a control character in a value or caption is drawn as a WinAnsi code that is not that character (C0, DEL and the C1 row #648 only documents) #782

Backlog

Description

@Tim81

Why

ISO 32000-1, 12.7.1: the appearance "shall be consistent with the object's current value as a field". Annex D.2, note 3: in WinAnsiEncoding "all unused codes greater than 40 map to the bullet character"; codes below octal 40 have no character at all.

EscapePdfString (AcroFormBuilder.cs) copies any character below U+0080 to the appearance as its byte, and WinAnsiEncoding.TryGetByte returns the same byte for every character up to U+00FF. #648 states that the appearance and /V "agree for U+0020 to U+007E and U+00A0 to U+00FF" and that U+0080 to U+009F differ; its acceptance only asks that the C1 behaviour "is stated in the remarks and pinned by a test, whichever way it goes", so #648 does not commit to fixing it, and it says nothing about U+0000 to U+001F or U+007F.

Measured on origin/main b2791ba (branch head 48c7f02), no claim, AddTextField and AddPushButton with the same value, Save:

value /V (and /MK /CA) bytes the appearance shows
a U+0001 b 61 01 62 61 01 62
a U+0009 b 61 09 62 61 09 62
a U+001F b FE FF 00 61 00 1F 00 62 61 1F 62
a U+007F b FE FF 00 61 00 7F 00 62 61 7F 62 (the bullet, by note 3)

So /V holds a control character and the appearance draws either nothing defined (a code below 0x20, which an embedded font would also reach as .notdef; ISO 19005-2 6.2.11.8 once #671 embeds a font) or a bullet. The audit's own WinAnsiDecode helper maps 0x00 to 0x1F and 0x7F to themselves, so a test built on it would not see the bullet.

Sweep: text field value, choice field selected or first option, push button caption (the three EscapePdfString callers). LF and CR are escaped as \n and \r and drawn in one Tj (#774, #715).

Proposal

Draw every character that has no WinAnsi glyph of its own (U+0000 to U+001F, U+007F and U+0080 to U+009F) in one way that cannot be mistaken for another character, for example as nothing or as the space the field already uses, and keep /V as given. 2.3.3 saved these values, so the fix changes the appearance, listed in the CHANGELOG, and refuses nothing; #484 lists the 3.0 refusal. Move the audit's #648 row to this issue.

Acceptance

  • For each of U+0001, U+0009, U+001F, U+007F, U+0080 and U+0095 in a text field value, a choice option drawn as the value and a push button caption: the save succeeds, /V holds the character, and the appearance draws nothing that reads as another character.
  • ConformanceAuditG6Tests.Iso32000_1_12_7_1_TheAppearanceOfAControlCharacterValueIsConsistentWithTheValue asserts that outcome, with WinAnsiDecode mapping the unused codes as Annex D.2 note 3 says.
  • A value with none of these characters writes the same bytes as before.

Activity

  1. added
    bug
    on Nov 29, 2026
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

    bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions