reading a cookie field that was set not in english with node express
i have built a login system using angular.js and node (Express, passport).
in my server i am setting a cookie:
res.cookie('user', JSON.stringify({
'firstName': firstName,
'role': role
}));
the fields firstName and role are being brought from the req.user
(passport library) like this:
if(req.user) {
role = req.user.role;
firstName = req.user.firstName;
}
my client side reads this cookie:
currentUser = $cookieStore.get('user')
my problem is that my html page will not show the correct firstName in
hebrew letters, instead i will get something like ( ×××××) or other
nonsence letters.
i believe that the problem is when the req.login(user) is being called,
the hebrew characters are being translated to something else that when
req.user.firstName is being accessed, something wrong will be retrieved.
please help me
No comments:
Post a Comment