Post an object in Angular encode string attributes

时间:2017-07-17 15:28:19

标签: angular typescript character-encoding

I have an object wich is :

export class ActionLog { id: number actionDate: Date managerId: number manager: string title: string description: string }

I need to do a put request with in parameter this object. My problem is I need the content of description, but after the request the description is encode. Or I don't want it !

For exemple if I give "éàé" in description. It is all right before the put. But when I receive it in my back-end, I receive strange characters. And not at all "éàé".

updateActionLog(candidateId: number, actionLog: ActionLog): Promise<void> {
 console.log(actionLog.description); // print "éé"
 return this.http.put(`api/candidates/${candidateId}/action-logs`, actionLog).toPromise().then(res => {}).catch(this.handleError);}

I tried to encode with different type my string description but I obtained no result.

So to be precise I need the Json Object but I need also the string description well formated.

I hope someone have a good answer for this. Thanks.

0 个答案:

没有答案