Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

thirty-five。 RestTemplate Chinese garbled code

Shulou Source: shulou.com Published: 2022-06-03 04:38:26 11月25日 Update

Solution:

When setting httpheader, add utf-8 coding

String body = "Hello Chinese"; RestTemplate restTemplate = new RestTemplate (); HttpHeaders headers = new HttpHeaders (); MediaType type = MediaType.parseMediaType ("application/json; charset=UTF-8"); headers.setContentType (type); HttpEntity formEntity = new HttpEntity (body, headers)

Tags: Chinese Hello method time coding utf-8 garbled Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Apple Shulou Technology Microsoft Xiaomi