Ahmed Shalash
Ahmed Shalash

Reputation: 143

Json data appeard to ;ء if contain arabic words while using post restful web services from html form action

Json data appeard to ; &#1569 ; if contain arabic words while using post restful web services from html form action

Json result

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

code from my html page

<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>

code from my 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;

    }

Upvotes: 0

Views: 138

Answers (1)

Ahmed Shalash
Ahmed Shalash

Reputation: 143

Hello it was solved by add this to the header of html

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

Upvotes: 2

Related Questions