If I browse to https://api.stackexchange.com/2.2/search?site=stackoverflow&tagged=racket via Chrome, it displays a bunch of JSON containing the appropriate content. But when I run the following NodeJS program:
var request = require("request");
var EventEmitter = require("events").EventEmitter;
var body = new EventEmitter();
request("https://api.stackexchange.com/2.2/search?site=stackoverflow&tagged=racket", function(error, response, data) {
body.data = data;
body.emit('update');
});
body.on('update', function () {
console.log(body.data); // HOORAY! THIS WORKS!
});
Which should display the same content, I get a bunch of garbled symbols, like this:
�u1@�@�P��e�c�4���b0d�ysDl6�F�O���`�:cד�xۼ]�ɦi����Gplپ�d{k��EFPt��^v�c�<��Y@rI9�� 2F��I�*�uBI%q��f)�� �"�
�/�Tm5��ڵ�����u�\%L��9Ѩ������G�q93�3B����30i��T��}�ih�PN%�Z�G�G6��P����܇�N�9e��G�#6rlߨ��(����J
q �
&e��L2!�eRD&��Qʉ�)��h2��u������'
E/jX�tP�R�ON�wj�ت�|��
C���EH8�m/v�-�0����
�G;�����n���ɦn�z��|E�7
��� ��i��<,��Hj���d�:���t(��5�Q�:O�M�����^��LZ��`�����iH�����@�'N8���hA�h��hD����,��Y�)`�j�KS:_
�^lV���T9����@߁�K��������� ��� �Ǒs����� E��q�Xf�
yM�K�u`L�,��8�4���8?]��÷�V�1�nQ� �v����'#��]���22�$ሓ�����p�����R�M�-u���X
���BF ���'�
Does anyone know what I'm doing wrong?