'Test uploading subs containing BOM(Byte Order Mark), e.g. U+FEFF'

def test_subs_uploading_with_byte_order_mark(self):

    filedata = textwrap.dedent('\n                                                1\n                                                00:00:10,500    -->    00:00:13,000\n                                                Test    ufeff    characters\n\n                                                2\n                                                00:00:15,000    -->    00:00:18,000\n                                                At    the    left    we    can    see...\n                                ').encode('utf-8-sig')
    self.assertIn('ufeff', filedata)
    self.ufeff_srt_file.write(filedata)
    self.ufeff_srt_file.seek(0)
    link = reverse('upload_transcripts')
    filename = os.path.splitext(os.path.basename(self.ufeff_srt_file.name))[0]
    resp = self.client.post(link, {'locator': self.video_usage_key, 'transcript-file': self.ufeff_srt_file, 'video_list': json.dumps([{'type': 'html5', 'video': filename, 'mode': 'mp4'}])})
    self.assertEqual(resp.status_code, 200)
    content_location = StaticContent.compute_location(self.course.id, 'subs_{0}.srt.sjson'.format(filename))
    self.assertTrue(contentstore().find(content_location))
    subs_text = json.loads(contentstore().find(content_location).data).get('text')
    self.assertIn('Test    ufeff    characters', subs_text)
