The header just denotes what the content is encoded in. It is not necessarily possible to deduce the type of the content from the content itself, i.e. you can't necessarily just look at the content and know what to do with it. That's what HTTP headers are for, they tell the recipient what kind of content they're (supposedly) dealing with.

Content-type: application/json; charset=utf-8 designates the content to be in JSON format, encoded in the UTF-8 character encoding. Designating the encoding is somewhat redundant for JSON, since the default (only?) encoding for JSON is UTF-8. So in this case the receiving server apparently is happy knowing that it's dealing with JSON and assumes that the encoding is UTF-8 by default, that's why it works with or without the header.

Does this encoding limit the characters that can be in the message body?

No. You can send anything you want in the header and the body. But, if the two don't match, you may get wrong results. If you specify in the header that the content is UTF-8 encoded but you're actually sending Latin1 encoded content, the receiver may produce garbage data, trying to interpret Latin1 encoded data as UTF-8. If of course you specify that you're sending Latin1 encoded data and you're actually doing so, then yes, you're limited to the 256 characters you can encode in Latin1.

当指定

Content-type: application/json;

时,默认编码就是utf-8,不需要额外指定

http post Content-type: application/json; charset=utf-8的更多相关文章

  1. org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/json;charset=UTF-8' not supported

    最后找到我的问题,springmvc配置文件中没加 <mvc:annotation-driven/> java代码: @RequestMapping(value="/reques ...

  2. Content type 'application/json;charset=UTF-8' not supported异常的解决过程

    首先说一下当时的场景,其实就是一个很简单的添加操作,后台传递的值是json格式的,如下图 ,后台对应的实体类, @Data @EqualsAndHashCode(callSuper = false) ...

  3. org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/json;charset=UTF-8' not supported或其他Content type不支持处理

    很久没从头到尾搭框架,今天搭的过程中,springmvc controller方法入参用@RequestBody自动绑定参数时一直提示各种 not supported 排查问题有两个解决路径: 1)使 ...

  4. SpringMVC在使用JSON时报错信息为:Content type 'application/json;charset=UTF-8' not supported

    直接原因是:我的(maven)项目parent父工程pom.xml缺少必要的三个jar包依赖坐标. 解决方法是:在web子模块的pom.xml里面添加springMVC使用JSON实现AJAX请求. ...

  5. ajax使用向Spring MVC发送JSON数据出现 org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported错误

    ajax使用向Spring MVC发送JSON数据时,后端Controller在接受JSON数据时报org.springframework.web.HttpMediaTypeNotSupportedE ...

  6. jmeter报"msg":"Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported"的解决方法

    1.报"msg":"Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supporte ...

  7. Jmeter发送post请求报错Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported

    常识普及: Content-type,在Request Headers里面,告诉服务器,我们发送的请求信息格式,在JMeter中,信息头存储在信息头管理器中,所以在做接口测试的时候,我们维护Conte ...

  8. Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported

    Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported告诉你,你的请求头是application/x- ...

  9. 接入WxPusher微信推送服务出现错误:Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported

    背景 使用WxPusher微信推送服务 ,可以及时的将服务的一些运行异常信息,发送到自己的微信上,方便了解服务的运行状态(PS:这个服务是免费的). 你可以在这里看到WxPusher微信推送服务的接入 ...

  10. springboot 报错 Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported

    开始 controller 方法写的是 @RequestMapping( value = "/add", method = RequestMethod.POST ) public ...

随机推荐

  1. 线程互斥,mutex

    body, table{font-family: 微软雅黑; font-size: 10pt} table{border-collapse: collapse; border: solid gray; ...

  2. iOS笔记之ScrollView

    ScrollView三个基本的要理解的属性: contentSize The size of the content view.所以很好理解,contentSize也就是scrollView可滚动的区 ...

  3. js enter键激发事件

    document.onkeydown = function (e) {            if (!e) e = window.event;            if ((e.keyCode | ...

  4. Openlayers4中地图的导出

    概述: 本文讲述Openlayers4中地图的导出,包括调用天地图切片跨域.Geoserver11 WMS跨域等. 效果: 导出图片 页面展示 实现代码: document.getElementByI ...

  5. cool 软件 —— Carnac(实时桌面显示按键)

    1. Carnac 下载地址:Carnac, the Magnificent Keyboard Utility 使用说明:carnac – 在屏幕实时显示按键操作

  6. Springboot - 建立简单的用户登录系统

    在开始编码前,先建立几个Package(可以按个人习惯命名),如图 1.Controllers 用于存放控制器类 2.Models 用于存放数据实体类 3.Repositories 用于存放数据库操作 ...

  7. test20181029 数列

    题意 分析 考场做法 打表发现,最后的循环节一定是\(\gcd(a_1,a_2),\gcd(a_1,a_2),0\)这种形式,而稍微思考一下便知道这显然是一般情况. 然后都有gcd了,发现操作的实质都 ...

  8. IIS7Appcmd 命令详解

    IIS7 Appcmd 命令详解 废话不说!虽然有配置界面管理器!但是做安装包的时候命令创建是必不可少的!最近使用NSIS制作安装包仔细研究了一下Appcmd的命令,可谓是功能齐全. 上网查了些资料, ...

  9. 在Windows Server 2012启用或关闭Internet Explorer增强的安全配置

    在 Windows Sever 2012 中打开 IE 浏览器时,IE10 会出现[已启用 Internet Explorer 增强的安全配置]的提示信息. 在安全性等级中会设置以[高安全性],如果我 ...

  10. springMVC国际化配置和使用

    下面是基于session的,springMVC国际花的一个例子: 需求是 输入url:展示中文界面 http://localhost:8080/MySSM/user?lang=zh 输入url:  展 ...