You are probably right, there may be other chars in there such as embedded returns or even some other more wild and wonderful stuff. I'll give your fix a go and see if it works. Thanks for the speedy response, 8^) See ya Phil phil@philh.org ----- Original Message ----- From: Alexander Staubo <alex@mop.no> To: Zope Mailing List (E-mail) <zope@zope.org>; 'Phil Harris' <phil@philh.org> Sent: Wednesday, July 07, 1999 12:53 PM Subject: RE: [Zope] Binary data in Zope DTML documents
It shouldn't be your tab characters -- I tried adding tabs to a document in Zope 1.11.0pr1, and Zope returned the correct content type. The code to determine whether a document is binary can be found in OFS\content_types.py:
find_binary=ts_regex.compile('[\0-\6\177-\277]').search
When Zope detects binary data, it returns the content type application/octet-stream rather than text/html.
Although as you can see, this won't be triggered by tabs, in my opinion the above regex is way too stringent: This has the unfortunate effect of treating documents with valid, non-binary ISO characters -- including international characters, the Euro, Pound and Yen symbols, TM, and old-style fractions. Sure, HTML character-reference entities can (and should?) be used instead of the actual characters, but that doesn't change the fact that the binary detection is just plain wrong.
Btw, you should search your document carefully for the offending characters. Since it's unlikely that the tabs are triggering the problem, there ought to be others. For my own Zope installation I just commented out the binary check, though. In the end, I don't write that many binary DTML documents. :-)
Unless anyone has objections, I'll post this to the Collector.
-- Alexander Staubo http://www.mop.no/~alex/ "What the hell, he thought, you're only young once, and threw himself out of the window. That would at least keep the element of surprise on his side." --Douglas Adams, _The Hitchhiker's Guide to the Galaxy_
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Phil Harris Sent: 7. juli 1999 13:18 To: zope@zope.org Subject: [Zope] Binary data in Zope DTML documents
Hi all,
I have a database which has a field called content, this field is mostly text but has a few 'tab' chars in it.
It seems that zope then treats this data differently and Netscape then tries to download the file rather tahn render it. IE though renders it correctly!
Is it just me or does Zope do this sort of thing, that is, make a distinction when a file has 'binary' data in it.
Any ideas?
TIA
Phil phil@philh.org
_______________________________________________ Zope maillist - Zope@zope.org http://www.zope.org/mailman/listinfo/zope
(For developer-specific issues, use the companion list, zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )