Only UTF-8 is available
来源:互联网 发布:义乌淘宝运营培训班 编辑:程序博客网 时间:2024/05/22 12:06
今天采用https 进行Post数据并解析接收到的数据,很奇怪地接收到响应“Only UTF-8 is available.” ,这是什么东东?!
百度google了半天,没查到。自己动手了~~
Only UTF-8 is available. 仅支持UTF-8,明显响应流所需要的请求头内容类型应该显示指出发出的请求为UTF-8编码的。
调试代码,发现一处代码很可能是根源,like this:
public static HttpWebRequest CreateHttpRequest(string reqURL, string httpMethod) { HttpWebRequest req = null; try { Uri uri = new Uri(reqURL, UriKind.Absolute); req = (HttpWebRequest)WebRequest.Create(uri); req.Method = httpMethod; req.KeepAlive = true; req.ContentType = "application/json;";//应该加入字符集UTF8 } catch//(Exception ex) { throw; } return req; }
修改为:
req.ContentType = "application/json;charset=UTF-8";
再次调试,ok,接收到响应流内容都正常了~~
- Only UTF-8 is available
- AnnotationAwareAspectJAutoProxyCreator is only available on Java 1.5 and higher
- AnnotationAwareAspectJAutoProxyCreator is only available on Java 1.5 and higher
- AnnotationAwareAspectJAutoProxyCreator is only available on Java 1.5 and higher
- AnnotationTransactionAttributeSource is only available on Java 1.5 and highe
- AnnotationAwareAspectJAutoProxyCreator is only available on Java 1.5 and higher
- AnnotationAwareAspectJAutoProxyCreator is only available on Java 1.5 and higher
- AnnotationTransactionAttributeSource is only available on Java 1.5 and higher
- AnnotationTransactionAttributeSource is only available on Java 1.5 and higher
- 解决TypeName is not valid. Type parameters are only available if source level is 5.0.
- Syntax error, parameterized types are only available if source level is 5.0
- Syntax error, annotations are only available if source level is 5.0
- Myeclipse "Syntax error,parameterized types are only available if source level is 5.0
- eclipse编译Syntax error, parameterized types are only available if source level is 5.0
- 【问题解决】Syntax error, parameterized types are only available if source level is 5.0
- 报错!Syntax error,parameterized types are only available if source level is 5.0 解决方法
- Problem:Syntax error, annotations are only available if source level is 1.5
- Syntax error, annotations are only available if source level is 1.5
- eXosip认证/注册过程
- Xorg的一些问题和随想
- 使用g++编译OpenCV程序
- 23种设计模式(5):原型模式
- PAT (Advanced Level) Practise —— 1002. A+B for Polynomials
- Only UTF-8 is available
- 字符串的全排列
- 手把手教你ARC——iOS/Mac开发ARC入门和使用
- VC6.0 实现欢迎界面
- 资深HR告诉你,面试中你不知道的那些秘密!
- no environment 异常
- js幻灯片存档一个
- iOS6.0以上系统访问系统相册隐私提示方法截获
- Python介绍