Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
springrestapi中的编码_Spring_Rest_Spring Rest - Fatal编程技术网

springrestapi中的编码

springrestapi中的编码,spring,rest,spring-rest,Spring,Rest,Spring Rest,我有一个rest端点,在这里我向用户发送json。但俄罗斯符号存在编码问题 @RequestMapping(value = "/{id}", method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE) @Transactional public ResponseEntity<String> getOrder(@PathVariable String id, @RequestParam Map<S

我有一个rest端点,在这里我向用户发送json。但俄罗斯符号存在编码问题

@RequestMapping(value = "/{id}", method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
@Transactional
public ResponseEntity<String> getOrder(@PathVariable String id, @RequestParam Map<String, String> params)
{

        String result = "{"id":"composite_order2","href":"/orderManagement/2.0/serviceOrder/composite_order2","state":"Acknowledged","orderDate":"2018-05-17T18:27:29+03:00","orderSpecification":{},"relatedParty":[{"role":"customer","name":"\" АГРО - СТАР \""}]}"
        return new ResponseEntity<>(result, HttpStatus.OK);

}
名称的俄文符号替换为??-???? ResponseEntry类来自SPring框架
org.springframework.http.ResponseEntity

您是否尝试过
products=MediaType.APPLICATION\u JSON\u UTF8\u VALUE
?@Icaro Pinhole否,将尝试并更新。因此,您不必返回字符串,您可以返回实际对象并使用Jackson为您序列化和反序列化它
{"id":"composite_order2","href":"/orderManagement/2.0/serviceOrder/composite_order2","state":"Acknowledged","orderDate":"2018-05-17T18:27:29+03:00","orderSpecification":{},"relatedParty":[{"role":"customer","name":"\" ???? - ???? \""}]}