It's cool that your problem was solved. Thanks for the best practice!

Best,
Alex.

On Thursday, August 1, 2019 at 10:26:35 AM UTC+3, Dmitri wrote:
>
> At first I thought the problem was in API, but the problem was in the 
> encodings when sending the request POST. Solution to this problem 
> *encodeURIComponent()*. It is enough to encode each transmitted parameter 
> with *encodeURIComponent().*
>
>
> var str = 'm=put&a=';
> obj = {'B3':'bla-bla (in Russian) to write text'};
> var data = JSON.stringify(obj);
> data = encodeURIComponent(data);
> data = str+data;
>
>
> var link = 'https://script.google.com/macros/s/XXXXXXXXXX/exec'; // 
> Google Script
> const XMLHttpRequest = Components.Constructor("@
> mozilla.org/xmlextras/xmlhttprequest;1");
> var xhr = XMLHttpRequest();
> xhr.open('POST', link, false);
> xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded; 
> charset=utf-8');
> xhr.send(data);
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Spreadsheets API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-spreadsheets-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-spreadsheets-api/59c045b1-c081-4f9b-94ed-f2a98c4341ae%40googlegroups.com.

Reply via email to