If encoding fails use ? as ANSI fallback character

#321 Merged at 88959ad
Repository
Deleted repository
Branch
default (e6ecd9ec055b)
Repository
pygments-main
Branch
default
Author
  1. Gaurav Jain
Reviewers
Description

Addresses Issue #964. The existing code would print an non ANSI character as a fallback character causing garbage in the output. This changes the code to use '?' as a fallback character when encoding fails.

  • Issues #964: Cyrillic + utf8 + rtf = bug resolved

Comments (5)

  1. Tim Hatch

    fyi jambonrose is working on rewriting this from the spec to be full Unicode compatible -- the rtf formatter is a mess right now, unnecessarily.

      1. Andrew Pinkham

        I've got two patches for the issue, but have been unable to attach them. I've instead linked to the two files in issue #964.

        Only one patch should be applied. One maintains legacy support (partially implemented at the moment) while the other is pure unicode. If the description in the issue is not adequate, I'm happy to answer any questions.

        I've run both patches using a narrow build of Python 2.7 and in Python 3.3, and got expected results. Given direction for which patch is more desirable, I'd be happy to work with Gaurav on this pull request to fix the formatter and provide a suite of tests for the issues encountered.

        Edit: Whoops! Just realized this pull request has already been merged. How should I proceed?