0

I have a node js project with MySql database. I have to use Persian data in my DB like:

UserModel = {id: 1200, firstName: 'صابر', lastName: 'سجادی' , nationalCode:'4640147800', displayName: 'saber-sajadi', status: 1, createDateTime: null };

so for run stored procedure i need to convert object to string with this Code:

let objectToString = (object) => {
    let _string = "";
    let i = 1;
    for (let key in object) {
        var val = object[key];
        _string += (val == undefined || val == null) ? `null` : `'` + val + `' `;
        if (i < Object.keys(object).length) {
            _string += " , ";
            i++;
        }
    }
    return _string;
}



I expect the output of the function to be as follows:
enter image description here
but it return:
1200,'صابر','سجادی','4640147800','saber-sajadi','1',''

Please help me to solve this problem

  • your output is OK. it's a RTL problem for your text editor. you can copy and paste your output to nodepad++ or word to see the result. – Majid Hajibaba Aug 23 '20 at 06:59

1 Answers1

0

we can use this function to solve problem:
function wrap(str){ return '\u202B' + str + '\u202C'; }