PowerShell Bitbucket PowerGUI Text Binary Encoding UTF-8 with SourceTree

How to setup Dell Quest PowerGUI to edit PowerShell PS1 scripts to Bitbucket with the correct UTF-8 Text encoding to overcome the erroneous Binary Encoding

We use the following workflow to update Microsoft PowerShell (VMware PowerCLI actually) scripts in the Atlassian Bitbucket GIT repository and had this same issue when getting started out of the box with defaults.

Workflow

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.

Procedure

  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


 

Image

Image

 

 

 

Image

Image

Image

 

Image

 

Image


 

powershell, powergui, powercli, text, binary, sourcetree, bitbucket