When working in AppleScript, using Script Editor to save a file as text generally encodes it in Latin-9, or Mac OS Roman if accented characters are used. But if any characters not covered by those sets are present, the text file is encoded as UTF-16LE. And if such a file is clicked on in Bitbucket, the file is downloaded rather than displayed and colourized inline.
As an example, here's a UTF-16LE file: https://bitbucket.org/EricFromCanada/ericfromcanada.bitbucket.org/src/55865a3ee2bf/applescript/close%20Safari%20Web%20Inspector.applescript
And its next revision, after conversion to UTF-8+BOM: https://bitbucket.org/EricFromCanada/ericfromcanada.bitbucket.org/src/51ba083a8253/applescript/close%20Safari%20Web%20Inspector.applescript