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:
   
![tGBBeWues4](https://github.com/apache/dubbo/assets/53480612/2de97c02-e889-4ae0-bdbd-54c7e26203b4)
   
![img_v2_2f58fbac-41b0-42d8-87aa-fb32282425al](https://github.com/apache/dubbo/assets/53480612/f82a8e93-7c0d-495a-abbe-c48ef9f8da5f)
   
![BX5Jf8ALdE](https://github.com/apache/dubbo/assets/53480612/79f880af-a075-4b4e-b37e-c302f4b49b23)
   


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

Reply via email to