We have a javascript browser app which uses the google drive api and the google drive picker to select the file:
let request = window.gapi.client.drive.files.get({
fileId: fileId,
alt: 'media'
});
request.execute(file => {
this.loadFile(file);
});
We are using a custom mime type to select only the right files. The file is a plain text file with json content in utf-8 encoding.
When I execute the script above, this.loadFile
receives the content with broken character encoding. When I download the file directly from google drive, I get a correctly encoded utf-8 file.
When I upload this file manually with the ending .json
, drive sets the mime type to application/json
. Loading that file then with the above method, the content is correctly encoded in the result.
Is there a way to use a custom mime type and specify to use utf-8 for it? E.g. can I register the mime type in Google Drive?
I do not see a parameter on the get api.