[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] can't open file with strange characters



In article <mac-perl.3580C202.2519@datahost.com>, michael@datahost.com wrote:

>I am saving some web documents as "source" from Netscape and running
>them through a macperl script that I have.
>
>Some of the documents return a "cannot open" error.
>
>I notice, when I open these documents with simple text, that they have
>square-boxe characters in place of where the line breaks should be.
>
>Can anyone explain what the square boxes are doing there and what I need
>to do to be able to open the files with macperl?

I'm not sure why you can't open them, but the square boxes are Unix-style
newline characters--Unix uses newline characters (\012) to signal the end
of a line, whereas the Mac uses carriage returns (\015). (So if you open a
Unix text file on a Mac you see boxes and one long line, unless the
software you are using checks for this.) You can easily do the conversion
with a Perl script, although if you can't open them in Perl this won't
help you.

BBEdit handles these line-ending issues elegantly, and you could pretty
easily write an AppleScript (blasphemy!) to have BBEdit open them, and
resave them with Mac line endings. Also, there are numerous shareware
products out there which will do the conversion for you in a drag-and-drop
fashion--if you need a reference send me a private email and I can look up
some names/URLs for you.
-- 
__________________________________________________________________________

Jeff Clites                Online Editor           http://www.MacTech.com/
online@MacTech.com         MacTech Magazine
__________________________________________________________________________

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch