本文介绍了服务器未提供 charset=utf-8 时 Postman utf-8 编码问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Spring 已弃用 APPLICATION_JSON_UTF8 (application/json;charset=UTF-8) 注释,正如他们所说:

Spring deprecated APPLICATION_JSON_UTF8 (application/json;charset=UTF-8) annotation as they said:

     /**
     * A String equivalent of {@link MediaType#APPLICATION_JSON_UTF8}.
     * @deprecated as of 5.2 in favor of {@link #APPLICATION_JSON_VALUE}
     * since major browsers like Chrome
     * <a href="https://bugs.chromium.org/p/chromium/issues/detail?id=438464">
     * now comply with the specification</a> and interpret correctly UTF-8 special
     * characters without requiring a {@code charset=UTF-8} parameter.
     */
    @Deprecated
    public static final String APPLICATION_JSON_UTF8_VALUE = "application/json;charset=UTF-8";

当我从 Chrome 或命令行向 API 发送请求时,编码工作正常.但是,除非我使用 application/json;charset=UTF-8 进行生成,否则 Postman 不会显示正确的响应.

When I sent a request to API from Chrome or command line, encoding works correctly. But, Postman is not showing correct response unless I use application/json;charset=UTF-8 for producing.

有没有办法解决 Postman 上的这个问题?

Is there any way to fix that issue on Postman?

推荐答案

此问题已在较新版本中解决,如果仍然遇到问题请升级

this has been solved in newer versions, upgrade if you still encounter the issue

这篇关于服务器未提供 charset=utf-8 时 Postman utf-8 编码问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 19:43