Json数据出现;ء如果包含阿拉伯语单词,则使用来自html表单操作的post restful web服务

时间:2016-09-28 09:03:01

标签: html json rest spring-boot

Json数据出现; ء如果在使用来自html表单操作的post restful web服务时包含阿拉伯语单词

Json结果

{"messageText":" &# 160 4; & #1573 ;ج& #1585;& #1575;ء أ&#1610 ;&#1617 ;&#1613 ; &#1 605;&# 1605; ا يلي ر د ","senderName":"sdf","mobileNumbers":"asd","userName":"asd","sectionCount":5}
来自我的html页面的

代码

<form action="http://localhost:8090/home" method="post" enctype="multipart/form-data" >
          <LABEL for="message">message: </LABEL>
          <INPUT type="text" name="messageText"><BR>
          <LABEL for="senderName">Sender Name: </LABEL>
          <INPUT type="text" name="senderName"><BR>
          <LABEL for="Mobile Numbers">Mobile Numbers  </LABEL>
          <INPUT type="text" name="mobileNumbers"><BR>
          <LABEL for="userName">userNames  </LABEL>
          <INPUT type="text" name="userName"><BR>
           <LABEL for="userName">sectionCount  </LABEL>
          <INPUT type="number" name="sectionCount"><BR>


<INPUT type="submit" value="Send">

</form>

来自我的restful api的代码

@RequestMapping(value="/home",method=RequestMethod.POST,headers ="content-type=application/x-www-form-urlencoded;charset=UTF-8")
    @ResponseBody
    public  RequiredInputData  home(@ModelAttribute RequiredInputData require ,HttpServletResponse response) 

    {


        return require;

    }

1 个答案:

答案 0 :(得分:2)

你好,它是通过将它添加到html的标题

来解决的
<meta http-equiv="Content-type" content="text/html; charset=UTF-8">