----- Original Message ----- From: "Randal L. Schwartz" <[email protected]> To: "Kiffin Gish" <[EMAIL PROTECTED]> Cc: "Josh Rosenbaum" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; <[email protected]> Sent: Monday, October 24, 2005 4:24 PM Subject: Re: [Templates] cgi.header error : Bad header=\r\r\r
> >>>>> "Kiffin" == Kiffin Gish <[EMAIL PROTECTED]> writes: > > Kiffin> I do edit the original file using Komodo for Windows and then transfer > Kiffin> the files over via SCP to my server. > > Bing! SCP is likely doing a binary transfer, so your \r's are ending > up in the file. > > Kiffin> I'll have a look, but I still suspect that the chomping is not removing > Kiffin> 'all' whitespace like it is supposed to do. > > \r is special whitespace, generally not removed even when it says > "remove whitespace". > > Kiffin> I guess I could do something messy like pre-process the output and > Kiffin> gobble those nasty \r's before they cause havoc. > > No, just edit your scripts in a more sensible environment. > Komodo works great, you just have to know how to use it. I have built regexes with the Rx Toolkit that I never would have been able to make without it. You can see how a regex is applied to data on the fly. Anyway, to the OP, what Randal is explaining is your problem. You need to clean up your file before you give it to Template::Toolkit. I use the same environment, Komodo then SCP. go to: View -> View EOL Markers (Ctrl+Shift+7) you can see the line endings are [CR][LF]. Those [CR] characters are what is giving you trouble. Go to Edit -> Replace, and choose "Regular Expressions" for the "Use" dropdown. Put "\r" (without the quotes) in the "Find what" text box and leave the "Replace with" text box empty. Then click "Replace All". You will see all of those [CR]s dissappear. Now save and upload your file. This is not a Komodo specific thing, as you would have the same problem if you created your templates with notepad. In Komodo, if you go to Edit -> Prefrences and then click on the "New Files" category, you will see an option that says "Specify the EOL indicator for newly created files". Select "\n" and Komodo will end your lines of text with just a "\n" when you create a new file (the three options are "\n", "\r\n", and "\r"). With your file transfer client, you can configure it to transfer the file in ASCII mode which will strip the \r's out for you. On the *nix server, you can run "perl -pi -e 's/\r//' filename.tt" to strip the \r's out of the file. You could also use an application framework like CGI::Prototype or CGI::Application to build the http headers so you dont have to debug your header generator later. There are a lot of different ways you can solve the problem. Todd W. _______________________________________________ templates mailing list [email protected] http://lists.template-toolkit.org/mailman/listinfo/templates
