Skip to content

utf7.c: decode "+-" as a plus sign - #75

Open
prownd wants to merge 1 commit into
rrthomas:masterfrom
prownd:utf7.c-decode-as-a-plus-sign-s01
Open

prownd wants to merge 1 commit into
rrthomas:masterfrom
prownd:utf7.c-decode-as-a-plus-sign-s01

Conversation

@prownd

@prownd prownd commented Sep 21, 2026

Copy link
Copy Markdown

RFC 2152 specifies that "+-" encodes a plus sign. The decoder saw no Base64 character after the +', then swallowed the -' as the optional end of a shifted sequence, so every literal plus sign was silently lost:

$ echo '1 +- 1 = 2' | recode utf-7..utf-8
1 1 = 2

Output the plus sign. Also encode a plus sign as "+-", as recommended by RFC 2152, rather than as the longer, still valid, "+ACs-".

Add a test.

RFC 2152 specifies that "+-" encodes a plus sign.  The decoder saw no
Base64 character after the `+', then swallowed the `-' as the optional
end of a shifted sequence, so every literal plus sign was silently lost:

  $ echo '1 +- 1 = 2' | recode utf-7..utf-8
  1  1 = 2

Output the plus sign.  Also encode a plus sign as "+-", as recommended
by RFC 2152, rather than as the longer, still valid, "+ACs-".

Add a test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant