Web Component Post Text with Encoding

Hey guys,

Somewhere in my app I need to write some values to a Google Sheets document.
When the text is in English alphabet everything is fine and the Google Sheet updates perfectly.
But When I send Persian text, empty string is received on the Google side.

I’m using a Google App Script doPost(e) function to send data from my App to Google Sheets.
First, I used the simple Post Text Block and I saw problem with Persian text. Then I replaced it with the Post Text With Encoding Block, but the problem still persists.

Here’s the App Script code:


function doPost(e) {

var ss = SpreadsheetApp.openByUrl(“https://docs.google.com/spreadsheets/d/**********tmk/edit#gid=150301410”);

var sheet = ss.getSheetByName(e.parameter.sheet);

var customerID = e.parameter.customerID;

var name = e.parameter.name;

var gender = e.parameter.gender;

var consultantID = e.parameter.consultantID;

var phone = e.parameter.phone;

var city = e.parameter.city;

var dateOfBirth = e.parameter.dateOfBirth;

var satisfaction = e.parameter.satisfaction;

var referredIDs = e.parameter.referredIDs;

sheet.appendRow([customerID, name, gender, consultantID, phone, city, dateOfBirth, satisfaction, referredIDs]);

return ContentService.createTextOutput(“Row with customerID " + customerID + " appended.”);

}


I’ve also attached a screenshot of my blocks.

Would be really grateful for any help :slight_smile:

Show the text part from the above screenshot…

There is problem. I can use some hyphens are there in unwanted place

Did you try the UriEncode method from the web component together with your Persian text?
Taifun

1 Like

Thanks my friend! That was the key :heart_eyes:

SOLVED:

For example “گلابی” becomes “%DA%AF%D9%84%D8%A7%D8%A8%DB%8C” after UriEncode.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.