hi,

I have a interface need post two parameters (long string, cannot use get or path params), so i choose FormParam annotation:

   @Path(value="/song/search")
   @POST
   @Consumes("application/x-www-form-urlencoded;charset=utf-8")
   @Produces("application/json;charset=utf-8")
   ServiceResult getSongList(@FormParam("songs") String songsInfoJson, @FormParam("clientid") String clientId);


and i use reasteasy-client to call this interface, post paramters like below:

songs:[{"album":"Sunshine 光明随想","title":"婚礼场面舞","artist":"金元辉;","id":"fb49e3de456bee952c8c9b3d3d8977c4","fileName":"100455298.mp3","disk":-1,"duration":112431,"sid":-1,"size":1694184,"albumSid":-1,"albumId":-1},{"album":"","title":"幻想即兴曲","id":"934fdf53d47304e30b587cfae7219136","fileName":"73864517.mp3","disk":-1,"duration":376058,"sid":-1,"size":6018215,"albumSid":-1,"albumId":-1},{"album":"","title":"谷粒飞舞","id":"bffdd1bfa0bfedaf7690540221fee91e","fileName":"73891360.mp3","disk":-1,"duration":145658,"sid":-1,"size":2331813,"albumSid":-1,"albumId":-1}]
clientid:test123

when server side received, the songsInfoJson content changed to like below:

[{"album":"Sunshine å…‰æ˜Žéš æƒ³","title":"å©šç¤¼åœºé ¢èˆž","artist":"金元辉;","id":"fb49e3de456bee952c8c9b3d3d8977c4","fileName":"100455298.mp3","disk":-1,"duration":112431,"sid":-1,"size":1694184,"albumSid":-1,"albumId":-1},{"album":"","title":"å¹»æƒ³å ³å…´æ›²","id":"934fdf53d47304e30b587cfae7219136","fileName":"73864517.mp3","disk":-1,"duration":376058,"sid":-1,"size":6018215,"albumSid":-1,"albumId":-1},{"album":"","title":"谷粒飞舞","id":"bffdd1bfa0bfedaf7690540221fee91e","fileName":"73891360.mp3","disk":-1,"duration":145658,"sid":-1,"size":2331813,"albumSid":-1,"albumId":-1}]

========================

i find the problem is the charset is not set in http request header.

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("application", "x-www-form-urlencoded"), the consumes annotaion doesn't take effect.

         form = new Form();
         target.getInvocation().setEntity(Entity.form(form));


org.jboss.resteasy.client.jaxrs.internal.ClientInvocation

  public void setEntity(Entity entity)
   {
...
         Object ent = entity.getEntity();
         setEntityObject(ent);
         this.entityAnnotations = entity.getAnnotations();
         Variant v = entity.getVariant();
         
         //header set
         headers.setMediaType(v.getMediaType());
         headers.setLanguage(v.getLanguage());
         headers.header("Content-Encoding", v.getEncoding());
...

   }


if manual change x-www-form-urlencoded to x-www-form-urlencoded;charset=utf-8, the problem will save.
is this a bug or anything wrong with me.

--
Jianhua Zhang
iFLYTEK