On Nov 17, 2003, at 7:32 PM, Neal Richter wrote:
This part of the code is pretty cheese-whizzy, so attention Geoff!
Any insights? I am assuming that at some point this worked properly.
I *really* don't have much time. I'm attempting to finish my last chapter by Friday and that's going to take some work. Otherwise I would have been contributing some. So I can tell you what the code is *supposed* to do, but I can't really help you out on why anything is or is not working right now. I can't really adjust my real-world deadlines right now. :-(
35 // But we only want to decode into one form i.e. &foo; NOT &#nnn; 36 String decode(const String &coded) const 37 { return myTextWordCodec->decode(coded); }
So the problem with HTML entities is that you have multiple forms that are equivalent. The original codec code was designed for a 1:1 function between encoded and decoded forms. No, I don't remember if there's code in the base class or HtSGMLCodec to handle this 2:1 mapping.
So anything in HtSGMLCodec is going to be an attempt to munge the two separate forms on encoding into the entity and only get the "preferred form" (e.g. &) out on decode.
Intuitively I would think that if encode is as above, that decode should
be the reverse of encode:
return myNumWordCodec->decode(myTextWordCodec->decode(coded));
^^^^^^ ^^^^^^
But this makes the problem worse!
&#XXX; --> &XXX;
Wait, but you just called "decode" twice there. I don't understand your example. If there are bugs here, I'd make sure that there's something in the code to ensure only one mapping is done on decode. IIRC, I did it by way of "priority" -- it looked for the first matching form for decoding (i.e. &) and used that.
My $0.01, -Geoff
------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ ht://Dig Developer mailing list: [EMAIL PROTECTED] List information (subscribe/unsubscribe, etc.) https://lists.sourceforge.net/lists/listinfo/htdig-dev