Angular 在角度编码字符串属性中发布对象
我有一个对象,它是:Angular 在角度编码字符串属性中发布对象,angular,typescript,character-encoding,Angular,Typescript,Character Encoding,我有一个对象,它是: 导出类操作日志{ 身份证号码 行动日期:日期 managerId:号码 经理:字符串 标题:字符串 描述:字符串 } 我需要使用此对象中的参数执行put请求。我的问题是我需要描述的内容,但是在请求之后描述是编码的。或者我不想要它 例如,如果我在描述中给出“俎é”。在表决前一切正常。但当我在后端收到它时,我会收到奇怪的字符。而且一点也不“爱” updateActionLog(candidateId:number,actionLog:actionLog):承诺{ console
导出类操作日志{
身份证号码
行动日期:日期
managerId:号码
经理:字符串
标题:字符串
描述:字符串
}
我需要使用此对象中的参数执行put请求。我的问题是我需要描述的内容,但是在请求之后描述是编码的。或者我不想要它
例如,如果我在描述中给出“俎é”。在表决前一切正常。但当我在后端收到它时,我会收到奇怪的字符。而且一点也不“爱”
updateActionLog(candidateId:number,actionLog:actionLog):承诺{
console.log(actionLog.description);//打印“俎”
返回this.http.put(`api/candidateId/${candidateId}/action logs`,actionLog.toPromise().then(res=>{}).catch(this.handleError);}
我试图用不同的类型编码我的字符串描述,但没有得到结果
准确地说,我需要Json对象,但我也需要格式良好的字符串描述
我希望有人对此有一个好的答案。谢谢
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);}