title: google cloud function node js. not parsing arabic data
body: <p>Cloud function for data sync from Firebase to mysql not recognizig arabic data.
  <a href="https://i.stack.imgur.com/Hlt7T.png" rel="nofollow noreferrer">error showing after sending arabic data. generated logs below</a></p>
  <p>my cloud function code is below:</p>
  <pre><code>const functions = require('firebase-functions');
  const https = require('https')
  
  exports.myFunction = functions.firestore
    .document('distri/{docId}')
    .onWrite((change, context) =&gt; { 
      reqstatus = true;
  
      // console.log(change);
      //console.log(context);
  
      //console.log(change.after.data());
  
      obj = {};
      obj.id = context.params.docId;
      obj.table = 'distri';
      obj.data = change.after.data();
      data = JSON.stringify(obj);
      console.log(data);
  
      options = {
      hostname: 'xyz.com',
      port: 443,
      path: '/app',
      method: 'POST',
      headers: {
      'Content-Type': 'application/json; charset=UTF-8',
      'Content-Length': data.length,
      'Content-Encoding': 'utf-8'
      }
      }
  
    const req = https.request(options, res =&gt; {
    console.log(`statusCode: ${res.statusCode}`)
  
    res.on('data', d =&gt; {
    process.stdout.write(d)
    })
    })
  
    req.on('error', error =&gt; {
    console.error(error)
    reqstatus = false;
    })
  
    req.write(data)
    req.end()
  
    return reqstatus;
  
  });
  </code></pre>
  <p>Api is working fine when it recieves data in english. API is based on simple php which insert data into MYSQL.</p>