<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><DIV><BR><DIV><DIV>On Sep 27, 2006, at 12:24 PM, Karl Kleinpaste wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">That is, the reason &amp;amp; wasn't being properly handled is because [a]</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">all those EscapeSequences in thmlhtml.cpp being commented out lead to</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">handleEscapeString() returning false -- no substitutions exist -- and</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">so [b] because passThruUnknownEsc is false (see ctor), all &amp;symbols;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">are dropped.<SPAN class="Apple-converted-space">  </SPAN>The code was actually willfully eliminating every</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">possible such &amp;symbol;.<SPAN class="Apple-converted-space">  </SPAN>Turning on passThruUnknownEsc lets them go by</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">unmolested.</DIV></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV>I think the intention of the code was to let known entities pass through.</DIV><DIV><BR><BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">What I don't know is if this should be considered a correct fix,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">rather than just one that makes it work for me, a GS user.<SPAN class="Apple-converted-space">  </SPAN>That is,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">why would it ever be desirable _not_ to pass a &amp;symbol; just because</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">it's not known to the particular substitution set coded?<SPAN class="Apple-converted-space">  </SPAN>Hence, I</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">*think* it's correct just to turn on passThruUnknownEsc globally, but</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">I'm not positive.</DIV></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV>I think that you found that the code expected to strip out unknown entities. Entities that are not handled via html should not be passed through. So, if there were an entity &amp;disclaimer; for example, it should be stripped. When the block of addEscapeStringSubstitute was commented out, it changed the behavior.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I think the correct fix is to have something *like* the following:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" color="#760F50" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;">bool</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;"> ThMLHTML::substituteEscapeString(SWBuf &amp;buf, </SPAN></FONT><FONT class="Apple-style-span" color="#760F50" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;">const</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;"> </SPAN></FONT><FONT class="Apple-style-span" color="#760F50" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;">char</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;"> *escString) {</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN><FONT class="Apple-style-span" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;">DualStringMap::iterator it;</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN><FONT class="Apple-style-span" color="#760F50" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;">if</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;"> (!escStringCaseSensitive) {</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN><FONT class="Apple-style-span" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;">        </SPAN></FONT><FONT class="Apple-style-span" color="#760F50" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;">char</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;"> *tmp = </SPAN></FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;">0</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;">;</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN><FONT class="Apple-style-span" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;">stdstr(&amp;tmp, escString);</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN><FONT class="Apple-style-span" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;">toupperstr(tmp);</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN><FONT class="Apple-style-span" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;">it = p-&gt;escSubMap.find(tmp);</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN><FONT class="Apple-style-span" color="#760F50" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;">delete</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;"> [] tmp;</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN><FONT class="Apple-style-span" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;">} </SPAN></FONT><FONT class="Apple-style-span" color="#760F50" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;">else</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;"> </SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN><FONT class="Apple-style-span" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;">it = p-&gt;escSubMap.find(escString);</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN><FONT class="Apple-style-span" color="#760F50" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;">if</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;"> (it != p-&gt;escSubMap.end()) {</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;">        // This is the one line that changes</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;">        // It probably should get the declared escapeStart and escapeEnd</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN><FONT class="Apple-style-span" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;">buf += '&amp;' + escString + ';';</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN><FONT class="Apple-style-span" color="#760F50" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;">return</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;"> </SPAN></FONT><FONT class="Apple-style-span" color="#760F50" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;">true</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;">;</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN><FONT class="Apple-style-span" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;">}</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN><FONT class="Apple-style-span" color="#760F50" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;">return</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;"> </SPAN></FONT><FONT class="Apple-style-span" color="#760F50" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;">false</SPAN></FONT><FONT class="Apple-style-span" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;">;</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Monaco" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;">}</SPAN></FONT></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>And then uncomment the section in ThMLHTML ctor that declares the entity replacements. Note, the famous 4 entities &amp;amp;, &amp;quot;, &amp;gt; and &amp;lt;) should not be replaced, but should be passed. And IE does not handle &amp;apos; in xhtml (don't know about html) so it should be replaced. I don't know that all browsers (used by Sword applications) can handle Latin-1 entities. Recent ones do. The lowest common denominator would be to replace them with Latin-1 or UTF-8, depending on the encoding. </DIV><BR></DIV></BODY></HTML>