uploading text file by FTP: encoding problem?
Hi, I have a problem when I upload an ASCII text file into a zope2 folder. I have a plain-text file with double quotes and line breaks. However, once uploaded, double quotes become " and line breaks become \n. Even if I change the property into text/plain or text/xml, I get the same problem. Only if I create a file using the manager, then copy my text into it, that I keep the original formatting. Do I do something wrong? How to preserve the original encoding? Thanks. Eric
Eric Fernandez wrote at 2006-8-9 11:20 +0100:
I have a problem when I upload an ASCII text file into a zope2 folder. I have a plain-text file with double quotes and line breaks. However, once uploaded, double quotes become " and line breaks become \n. Even if I change the property into text/plain or text/xml, I get the same problem.
The default object type generated for "text/html", "text/xml" or "text/plain" is a "DTMLDocument" (and not a "File" object as you might except). The "__str__" method of "DTMLDocument" performs HTML escaping. That's why '"' may appear as """. You can install your own "PUT_factory" (search the mailing list archives for details) to control the type of object created during various types of uploads. -- Dieter
Selon Dieter Maurer <dieter@handshake.de>:
Eric Fernandez wrote at 2006-8-9 11:20 +0100:
I have a problem when I upload an ASCII text file into a zope2 folder. I have a plain-text file with double quotes and line breaks. However, once uploaded, double quotes become " and line breaks become \n. Even if I change the property into text/plain or text/xml, I get the same problem.
The default object type generated for "text/html", "text/xml" or "text/plain" is a "DTMLDocument" (and not a "File" object as you might except).
The "__str__" method of "DTMLDocument" performs HTML escaping. That's why '"' may appear as """.
You can install your own "PUT_factory" (search the mailing list archives for details) to control the type of object created during various types of uploads.
-- Dieter
Thanks a lot for the answer, that's exactly what I need. I found the topic in the Zope book, development version. Cheers, Eric
participants (3)
-
Dieter Maurer -
egf05@doc.ic.ac.uk -
Eric Fernandez