I'm having some trouble fetching a plain text file from the Zotero API. I'm consistently getting a binary blob that doesn't conform to the expected encoding. I'm not sure what I'm doing wrong. Here are the steps:
1. The file is set as an attachment via the JS Console, using Zotero.Attachments.importFromFile(), declaring "text/plain" as the contentType, and "utf-8" or "windows-1252" as the charset (with a file converted to the declared encoding).
2. Double-clicking on the attachment in the client pops up a view of the file content with numbered lines. Everything seems to be in order.
3. After sync, and after parsing some sync transactions to identify the attachment ID, I'm making an authenticated GET request:
4. The server response reports the contentType and charset declared to the local client when importing the file, so that information is reaching the server.
5. The response.text returned by the server is a binary blob that is neither UTF-8 nor windows-1252.
PDF and RTF files are processing correctly. I'm only having this problem with plain text attachments.
Grateful for any suggestions on what I might be doing wrong.
Frank