MajaChen commented on issue #13349: URL: https://github.com/apache/dubbo/issues/13349#issuecomment-1879523852
In English, I've read the code very carefully, I think I've come up a proper way to fix the problem, see the [pr](https://github.com/apache/dubbo/pull/13617), it also contains necessary unit test. ## cause: In consumer side, parameters in RequestTemplate will be encoded with UTF-8 and will be appended to http request uri. Chinese character like '李强' in parameters will be transformed to '%E6%9D%8E%E5%BC%BA' (The problem occur when using subclass of RestClient like OkhttpClient or HttpClientRestClient but not URLConnectionRestClient as demonstrated in unit test in RestClientTest) Then the request is sent to provider. In provider side, ReuqeFascade will parse the http request and extract the parameters from the uri, but forget to decode paramters with UTF-8, so Chinese character remains undecoded state, like '%E6%9D%8E%E5%BC%BA' ## solution: We need to decode the parameters with UTF-8 in RequestFascade.initParameters. For simplicity, I decode the whole uri and I'm pretty sure is safe even the uri is not encoded with UTF-8 at all in consumer side. You can refer the unit test in NettyRequestFacadeTest. ## demonstration:    -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
