Online editor re-encodes file, mangling special characters
I really like the "edit online" feature for minor changes. But when I was using it recently, I made a very small change but noticed that it changed other parts of the file, parts I did not modify directly.
- Create a file with UTF-8 character "±" (hex 0xC2B1) outside of Bitbucket's online editor.
- Edit it online in Bitbucket and make a change elsewhere in the file.
- Save it, and the character will be re-encoded as hex 0xB1 which is invalid UTF-8. I assume Bitbucket is treating the file as being in some other encoding. UTF-8 is not an exotic or rare encoding -- everywhere I've worked it has been the default, so I would expect Bitbucket to handle it properly.
I have a public repository where I reproduced the bug. Here is the commit where the unwanted change happened: