<div dir="ltr">hi,<div><br></div><div>I have a interface need post two parameters (long string, cannot use get or path params), so i choose FormParam annotation:</div><div><br></div><div><div>   @Path(value=&quot;/song/search&quot;)</div><div>   @POST</div><div>   @Consumes(&quot;application/x-www-form-urlencoded;charset=utf-8&quot;)</div><div>   @Produces(&quot;application/json;charset=utf-8&quot;)</div><div>   ServiceResult getSongList(@FormParam(&quot;songs&quot;) String songsInfoJson, @FormParam(&quot;clientid&quot;) String clientId);</div><div><br></div><div><br></div><div>and i use reasteasy-client to call this interface, post paramters like below:</div><div><br></div><div><div>songs:[{&quot;album&quot;:&quot;Sunshine 光明随想&quot;,&quot;title&quot;:&quot;婚礼场面舞&quot;,&quot;artist&quot;:&quot;金元辉;&quot;,&quot;id&quot;:&quot;fb49e3de456bee952c8c9b3d3d8977c4&quot;,&quot;fileName&quot;:&quot;100455298.mp3&quot;,&quot;disk&quot;:-1,&quot;duration&quot;:112431,&quot;sid&quot;:-1,&quot;size&quot;:1694184,&quot;albumSid&quot;:-1,&quot;albumId&quot;:-1},{&quot;album&quot;:&quot;&quot;,&quot;title&quot;:&quot;幻想即兴曲&quot;,&quot;id&quot;:&quot;934fdf53d47304e30b587cfae7219136&quot;,&quot;fileName&quot;:&quot;73864517.mp3&quot;,&quot;disk&quot;:-1,&quot;duration&quot;:376058,&quot;sid&quot;:-1,&quot;size&quot;:6018215,&quot;albumSid&quot;:-1,&quot;albumId&quot;:-1},{&quot;album&quot;:&quot;&quot;,&quot;title&quot;:&quot;谷粒飞舞&quot;,&quot;id&quot;:&quot;bffdd1bfa0bfedaf7690540221fee91e&quot;,&quot;fileName&quot;:&quot;73891360.mp3&quot;,&quot;disk&quot;:-1,&quot;duration&quot;:145658,&quot;sid&quot;:-1,&quot;size&quot;:2331813,&quot;albumSid&quot;:-1,&quot;albumId&quot;:-1}]</div><div>clientid:test123</div></div><div><br></div><div>when server side received, the songsInfoJson content changed to like below:</div><div><br></div><div>[{&quot;album&quot;:&quot;Sunshine å…‰æ˜Žéš æƒ³&quot;,&quot;title&quot;:&quot;婚礼场頢舞&quot;,&quot;artist&quot;:&quot;金元辉;&quot;,&quot;id&quot;:&quot;fb49e3de456bee952c8c9b3d3d8977c4&quot;,&quot;fileName&quot;:&quot;100455298.mp3&quot;,&quot;disk&quot;:-1,&quot;duration&quot;:112431,&quot;sid&quot;:-1,&quot;size&quot;:1694184,&quot;albumSid&quot;:-1,&quot;albumId&quot;:-1},{&quot;album&quot;:&quot;&quot;,&quot;title&quot;:&quot;幻想堳兴曲&quot;,&quot;id&quot;:&quot;934fdf53d47304e30b587cfae7219136&quot;,&quot;fileName&quot;:&quot;73864517.mp3&quot;,&quot;disk&quot;:-1,&quot;duration&quot;:376058,&quot;sid&quot;:-1,&quot;size&quot;:6018215,&quot;albumSid&quot;:-1,&quot;albumId&quot;:-1},{&quot;album&quot;:&quot;&quot;,&quot;title&quot;:&quot;谷粒飞舞&quot;,&quot;id&quot;:&quot;bffdd1bfa0bfedaf7690540221fee91e&quot;,&quot;fileName&quot;:&quot;73891360.mp3&quot;,&quot;disk&quot;:-1,&quot;duration&quot;:145658,&quot;sid&quot;:-1,&quot;size&quot;:2331813,&quot;albumSid&quot;:-1,&quot;albumId&quot;:-1}]<br></div><div><br></div><div>========================</div><div><br></div><div>i find the problem is the charset is not set in http request header.</div><div><br></div><div><div>org.jboss.resteasy.client.jaxrs.internal.proxy.processors.invocation.FormParamProcessor create the new form entity, for this entity, the media type is hard code as: APPLICATION_FORM_URLENCODED_TYPE = new MediaType(&quot;application&quot;, &quot;x-www-form-urlencoded&quot;), the consumes annotaion doesn&#39;t take effect.</div><div><br></div><div>         form = new Form();</div><div>         target.getInvocation().setEntity(Entity.form(form));</div></div><div><br></div><div><br></div><div><div>org.jboss.resteasy.client.jaxrs.internal.ClientInvocation</div><div><br></div><div>  public void setEntity(Entity entity)</div><div>   {</div><div>...</div><div>         Object ent = entity.getEntity();</div><div>         setEntityObject(ent);</div><div>         this.entityAnnotations = entity.getAnnotations();</div><div>         Variant v = entity.getVariant();</div><div>         </div><div>         //header set</div><div>         headers.setMediaType(v.getMediaType());</div><div>         headers.setLanguage(v.getLanguage());</div><div>         headers.header(&quot;Content-Encoding&quot;, v.getEncoding());</div><div>...</div><div><br></div><div>   }</div></div><div><br></div><div><br></div><div>if manual change x-www-form-urlencoded to x-www-form-urlencoded;charset=utf-8, the problem will save.</div><div>is this a bug or anything wrong with me.</div><div><br></div>-- <br><div class="gmail_signature">Jianhua Zhang<br>iFLYTEK<br></div>
</div></div>