How to stop TextWrangler changing the text file icon?
A support request was filed and Bare Bones responded quickly.

TextWrangler sets the file type (com.apple.FinderInfo; file icon) when it determines that the file name cannot be used to determine that it is a text file. The exact determination here is not too important; as I found, hence I would assume that source code files would fall into this category. The text encoding is a standard attribute and is set to indicate the file's character encoding.

To disable the writing of these extended file attributes, the following command is used;

defaults write com.barebones.textwrangler WriteExtendedAttributes -string "Never"


The command itself is documented in the TextWrangler help files; but not how it relates to the character encoding and file associations.

To find and clear the attributes of the modified file(s), you can use the following standard commands;

ls -@l # list the files with extended attributes
xattr -c filename.sh # where the file name and extension is as required