On Thursday 11 December 2003 06:24, Bjorn Stabell wrote:
I'd still keep <dtml-var "u''"> in there. It may work fine now, but I think you may have trouble with some documents where Japanese or Unicode text shows up further into the document; at that point ZPublisher may already have started writing something out and by that time it's too late to switch the encoding.
Position of <dtml-var "u' '"> is not important - Your method will have computed the whole document before ZPublisher starts to return anything to the client. The real reason for it is to *ensure* that the return value from your dtml is unicode. DTML will return a unicode object if any of its components are unicode, but a plain string otherwise. (and ZPublishers encoding process wont kick in unless it recieves a unicode object from your method). This throw-away unicode object guards against degenerate cases (for example, maybe an *empty* search results page) where your DTML might otherwise never see a unicode object. -- Toby Dickenson