erdomke / RtfPipe

Library for processing rich-text format (RTF) streams
MIT License
121 stars 44 forks source link

ansicpg RTF command gives error #73

Open fvanheeswijk opened 2 years ago

fvanheeswijk commented 2 years ago

We have an RTF with \ansicpg-535 as command, it gives the following error:

System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary. at System.ThrowHelper.ThrowKeyNotFoundException() at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at RtfPipe.TextEncoding.EncodingFromCodePage(Int32 codePage) at RtfPipe.Parser.GetControlWord(String name, Int32 number) at RtfPipe.Parser.d__18.MoveNext() at RtfPipe.Parser.Parse() at RtfPipe.Rtf.ToHtml(RtfSource source, XmlWriter writer, RtfHtmlSettings settings) at RtfPipe.Rtf.ToHtml(RtfSource source, RtfHtmlSettings settings)

In https://github.com/joniles/rtfparserkit/issues/13 I have found a similar issue, apparently negative numbers need to be treated differently.