How Do I Read and Write File with Mac CR and Western MacOS Roman?
I need to read an Adobe Acrobat FDF file which is evidently encoded as
- Legacy Mac (CR)
- Western (Mac OS Roman)
or so that’s what BBEdit tells me when I do a save as on an FDF file created from Adobe Acrobat Pro (form export data).
I need to read this file, make some changes to the data, then write out a new file in the same encoding.
Here’s the actual file, zipped:
LOA FDF Template 3-2.fdf.zip (688 Bytes)
As long as you’re running on system using a Roman language, MacRoman is the default. So a simple
write without any
as parameter will do the job.
The type of linefeed is irrelevant to the encoding — just use
return if you want to add any.
Thanks. How do I make sure the Read handler will automaticlly read either MacRoman OR UTF8?
You try UTF-8 first, and if that throws an error, try again with MacRoman.
If there are large files or slow disk access this is something more efficiently done using ASObjC, in that you can read a file as data, and then try the encodings without hitting the disk again.