As part of the shift to working with a plain text editor I would like to employ the 'perltidy' batch file and script to ensure my code is readable and consistent in presentation. However I have encountered a problem in doing so.

I use UTF-8 encoding with a matching BOM for all my Perl sources. Unfortunately when I run 'perltidy' on a file with this layout I recieve the following error:

Perltidy version is 20180220 1: unexpected character decimal 239 () in script 1: unexpected character decimal 187 () in script 1: unexpected character decimal 191 () in script 1: Giving up after error

If I remove the BOM, but otherwise keep the UTF-8 encoding then 'perltidy' works as expected. Alternately if I set the -UTF8 switch then I get both the error message and the entire source file becomes double-spaced on new lines. Is there any way around this problem?

"Aure Entuluva!" - Hurin Thalion at the Nirnaeth Arnoediad.

In reply to perltidy and UTF-8 BOM by morelenmir

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":