gapi.client.drive client doesn't handle UTF8 encoding properly

109 views
Skip to first unread message

Jeffrey Mathews

unread,
Jul 7, 2015, 11:12:30 AM7/7/15
to google-api-jav...@googlegroups.com
I've have run into a seeming problem with the handling of UTF-8 characters as I've begun working with the Google Drive Web Quickeditor repo (https://github.com/googledrive/web-quickeditor, and available as a demo online at http://googledrive.github.io/web-quickeditor):

A simple text file that I upload to Google drive (attached), which includes non-ascii accented characters and which renders and is editable from within Google Doc without any problem, is not rendering with the correct charset in quickeditor (i.e., 'sábado' comes through as 'sábado').  

Debugging the client-side JS, it appears that the call to gapi.client.drive.files.get (https://github.com/googledrive/web-quickeditor/blob/master/src/components/drive/drive.service.js#L60) returns the mis-encoded string (by way of a promise), instead of the properly encoded UTF-8.

I can't find documentation anywhere on the gapi.client.drive and the minified source is very hard to follow.  Any ideas on how to fix this?  

Thanks in advance.

Jeff Mathews
utf8.txt

D. M.

unread,
Mar 13, 2016, 10:53:46 AM3/13/16
to Google API JavaScript Client
jus tran into this problem myself, solution is...

 resp.body = decodeURIComponent(escape(resp.body)); // fix utf-8 issues
Reply all
Reply to author
Forward
0 new messages