Powershell Module Manifest file (.psd1) are detected as binary instead of text. (BB-6714)

Issue #5453 closed
created an issue

In the detailed commit window, we can not see the diff for a .psd1 file (Message "Binary file modified"), .psd1 are text file : http://msdn.microsoft.com/en-us/library/windows/desktop/dd878337%28v=vs.85%29.aspx

This is a very, very minor issue :)

Edit : it seems the problem is in fact with unicode encoding, like describe in #5648

Also, these extensions: .PS1 – Windows PowerShell shell script .PSD1 – Windows PowerShell data file (for Version 2) .PSM1 – Windows PowerShell module file (for Version 2) .PS1XML – Windows PowerShell format and type definitions .CLIXML - Windows PowerShell serialized data .PSC1 – Windows PowerShell console file .PSSC - Windows PowerShell Session Configuration file

Comments (13)

  1. Avner Silberman

    This applies to .ps1 files as well. I think this is pretty serious, as for windows development a lot of scripts are now in powershell as opposed to .cmd or .bat.

    Seriously though - how hard is it to get these treated like any other source file? Surely this is configuration and not a code change?

    Would appreciate some feedback on any plans to fix this.

  2. Vin S

    interestingly when you create repository it allows you to select powershell as a language to select from, This means it is aware of it, but when you click on powershell script file to check it source it is treated as binary and simply pops download dialogue box. I can't even see the source

    Update: had to save *.ps1 with ANSI encoding (instead of Unicode) in order make it identified as a text file

  3. Iben Rodriguez

    We use the following workflow to update powershell scripts in bitbucket and had this same issue when getting started out of the box with defaults...

    The default files created with PowerGui are having the 3 letter file name extension ps1 but when uploaded with Sourcetree they show up in Bitbucket as Binary so text features like edit or diff don't work. Based on the feedback here and with other google searches the fix for this was to indeed change the encoding to UTF-8, make a simple change to the file, and upload it again. After a few tries this works perfectly and is repeatable. There is a trick though as PowerGUI doesn't make it obvious how to change the encoding. Here are the steps...

    1. start powergui as you normally would. BTW - this is a windows program and I've tested this on Windows 8
    2. Choose "PowerShell Libraries" from the File menu
    3. Check the box to enable "Add-on.ScriptEditorEssentials" from the Snapins/Modules dialog box. Click OK.
    4. Now Enable UTF-8 Encoding from the File menu.
    5. That's it. Any file you save now will be UTF-8 encoded and show up properly in Bitbucket once uploaded.

    Reference: http://en.community.dell.com/techcenter/powergui/f/4833/t/19575613.aspx







  4. Log in to comment