﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc
429,Stream.render bug when strip_whitespace=False,cboos,hodgestar,"For the context, I noticed that TracHacks:WikiGoodiesPlugin's !ShowEntities macro was broken, as it displayed things like:

|| &hellip; || &hellip; ||

instead of the expected:

|| &hellip; || [[html(&hellip;)]] ||

I traced that to the `strip_whitespace` parameter of `Stream.render`:

{{{
#!pycon
>>> from genshi.builder import tag
>>> from genshi.core import Markup
>>> table = tag.table(tag.tr(tag.th('&hellip;')), tag.td(Markup('&hellip;')))
>>> list(table.generate())
[('START', (QName('table'), Attrs()), (None, -1, -1)), ('START', (QName('tr'), Attrs()), (None, -1, -1)), ('START', (QName('th'), Attrs()), (None, -1, -1)), ('TEXT', '&hellip;', (None, -1, -1)), ('END', QName('th'), (None, -1, -1)), ('END', QName('tr'), (None, -1, -1)), ('START', (QName('td'), Attrs()), (None, -1, -1)), ('TEXT', <Markup u'&hellip;'>, (None, -1, -1)), ('END', QName('td'), (None, -1, -1)), ('END', QName('table'), (None, -1, -1))]
>>> table.generate().render('xml')
'<table><tr><th>&amp;hellip;</th></tr><td>&hellip;</td></table>'
}}}

All fine so far, but with `strip_whitespace=False` we get the unexpected:

{{{
#!pycon
>>> table.generate().render('xml', encoding=None, strip_whitespace=False)
u'<table><tr><th>&amp;hellip;</th></tr><td>&amp;hellip;</td></table>'
}}}

I didn't investigate further yet, what `strip_whitespace=False` does is to prevent the `WhitespaceFilter` to be added to the `XMLSerializer` filters. So the bug happens only when that filter is not present... strange. 

Oh wait, this could be a problem with the string cache. I remember when reviewing [1038] that I was afraid that the cache wouldn't make a difference between escaped and unescaped strings, but I was not able to come up with a test case (maybe because I tested with the default `strip_whitespace=True`). To be continued...",defect,closed,major,0.6.1,Serialization,0.6,fixed,cache,
