0
votes

I've done some googling on this, and searched this site, but still can't seem to figure out how to resolve this specific issue, or understand why it is occurring.

My preferred text/code editor is Sublime text. But when opening various XML-formatted files (at the moment, namely .adg files, which are Ableton Live device preset files), they open as hexadecimal.

I recently added the user preference for "enable_hexadecimal_encoding": false in Sublime Text. However, despite that, the XML text is still not decoding and displaying properly. The characters and formatting are all scrambled with a ton of question marks everywhere. I checked in BBEdit, and it is displaying in Unicode (UTF-8), which is the same encoding I am opening it with in Sublime Text.

Does anyone know how to make Sublime Text open XML-formatted files properly and as reliably as BBEdit seems to? And why do files like this always seem to be readable in BBEdit although they aren't in Sublime Text?

2
Do you have a sample of such a file that you can link to for examination?OdatNurd
However, it looks like @idleberg figured it out in the answer below.Max Well

2 Answers

3
votes

I've taken a look at a freely available Ableton Device Group file (*.adg) by running the Unix file command on it.

$ file Traktor\ Filter.adg
Traktor Filter.adg: gzip compressed data, from Unix

I was able to open the file in my archive browser and found an XML inside. The explanation why BBEdit can read such a file can be found on their feature comparison chart:

Transparently reads and writes gzip (.gz) and BZ2 (.bz2) compressed files

The Compressor package implements a similar feature for Sublime Text, but unfortunately it does not open .adg files by default (despite its header looking good to me). Renaming the file to .gz did open the included XML, but did not let me edit it.

0
votes

Excellent info, @idleberg. Thanks! And after modifying the following in Compressor.py in the .sublime-package (opened using the zip browser package), I am able to easily open and read .adv files now in Sublime Text.

compression_formats = {
     '.gz': gzip.open,
     '.adv': gzip.open,
     # '.bz2': bz2.open,
}