mirror of
				https://gitee.com/binary/weixin-java-tools.git
				synced 2025-10-31 10:38:42 +08:00 
			
		
		
		
	jodd response 编码设置为UTF-8
This commit is contained in:
		| @ -4,6 +4,8 @@ import jodd.http.HttpConnectionProvider; | ||||
| import jodd.http.HttpRequest; | ||||
| import jodd.http.HttpResponse; | ||||
| import jodd.http.ProxyInfo; | ||||
| import jodd.util.StringPool; | ||||
|  | ||||
| import me.chanjar.weixin.common.bean.result.WxError; | ||||
| import me.chanjar.weixin.common.exception.WxErrorException; | ||||
| import me.chanjar.weixin.common.util.http.RequestHttp; | ||||
| @ -29,6 +31,7 @@ public class JoddMaterialDeleteRequestExecutor extends MaterialDeleteRequestExec | ||||
|  | ||||
|     request.query("media_id", materialId); | ||||
|     HttpResponse response = request.send(); | ||||
|     response.charset(StringPool.UTF_8); | ||||
|     String responseContent = response.bodyText(); | ||||
|     WxError error = WxError.fromJson(responseContent); | ||||
|     if (error.getErrorCode() != 0) { | ||||
|  | ||||
| @ -4,6 +4,8 @@ import jodd.http.HttpConnectionProvider; | ||||
| import jodd.http.HttpRequest; | ||||
| import jodd.http.HttpResponse; | ||||
| import jodd.http.ProxyInfo; | ||||
| import jodd.util.StringPool; | ||||
|  | ||||
| import me.chanjar.weixin.common.bean.result.WxError; | ||||
| import me.chanjar.weixin.common.exception.WxErrorException; | ||||
| import me.chanjar.weixin.common.util.http.RequestHttp; | ||||
| @ -31,6 +33,7 @@ public class JoddMaterialNewsInfoRequestExecutor extends MaterialNewsInfoRequest | ||||
|  | ||||
|     request.query("media_id", materialId); | ||||
|     HttpResponse response = request.send(); | ||||
|     response.charset(StringPool.UTF_8); | ||||
|  | ||||
|     String responseContent = response.bodyText(); | ||||
|     WxError error = WxError.fromJson(responseContent); | ||||
|  | ||||
| @ -4,6 +4,8 @@ import jodd.http.HttpConnectionProvider; | ||||
| import jodd.http.HttpRequest; | ||||
| import jodd.http.HttpResponse; | ||||
| import jodd.http.ProxyInfo; | ||||
| import jodd.util.StringPool; | ||||
|  | ||||
| import me.chanjar.weixin.common.bean.result.WxError; | ||||
| import me.chanjar.weixin.common.exception.WxErrorException; | ||||
| import me.chanjar.weixin.common.util.http.RequestHttp; | ||||
| @ -48,6 +50,7 @@ public class JoddMaterialUploadRequestExecutor extends MaterialUploadRequestExec | ||||
|     } | ||||
|  | ||||
|     HttpResponse response = request.send(); | ||||
|     response.charset(StringPool.UTF_8); | ||||
|     String responseContent = response.bodyText(); | ||||
|     WxError error = WxError.fromJson(responseContent); | ||||
|     if (error.getErrorCode() != 0) { | ||||
|  | ||||
| @ -4,6 +4,8 @@ import jodd.http.HttpConnectionProvider; | ||||
| import jodd.http.HttpRequest; | ||||
| import jodd.http.HttpResponse; | ||||
| import jodd.http.ProxyInfo; | ||||
| import jodd.util.StringPool; | ||||
|  | ||||
| import me.chanjar.weixin.common.bean.result.WxError; | ||||
| import me.chanjar.weixin.common.exception.WxErrorException; | ||||
| import me.chanjar.weixin.common.util.http.RequestHttp; | ||||
| @ -30,6 +32,7 @@ public class JoddMaterialVideoInfoRequestExecutor extends MaterialVideoInfoReque | ||||
|  | ||||
|     request.query("media_id", materialId); | ||||
|     HttpResponse response = request.send(); | ||||
|     response.charset(StringPool.UTF_8); | ||||
|     String responseContent = response.bodyText(); | ||||
|     WxError error = WxError.fromJson(responseContent); | ||||
|     if (error.getErrorCode() != 0) { | ||||
|  | ||||
| @ -4,6 +4,8 @@ import jodd.http.HttpConnectionProvider; | ||||
| import jodd.http.HttpRequest; | ||||
| import jodd.http.HttpResponse; | ||||
| import jodd.http.ProxyInfo; | ||||
| import jodd.util.StringPool; | ||||
|  | ||||
| import me.chanjar.weixin.common.bean.result.WxError; | ||||
| import me.chanjar.weixin.common.exception.WxErrorException; | ||||
| import me.chanjar.weixin.common.util.http.RequestHttp; | ||||
| @ -34,6 +36,7 @@ public class JoddMaterialVoiceAndImageDownloadRequestExecutor extends MaterialVo | ||||
|  | ||||
|     request.query("media_id", materialId); | ||||
|     HttpResponse response = request.send(); | ||||
|     response.charset(StringPool.UTF_8); | ||||
|     try (InputStream inputStream = new ByteArrayInputStream(response.bodyBytes())) { | ||||
|       // 下载媒体文件出错 | ||||
|       byte[] responseContent = IOUtils.toByteArray(inputStream); | ||||
|  | ||||
| @ -4,6 +4,8 @@ import jodd.http.HttpConnectionProvider; | ||||
| import jodd.http.HttpRequest; | ||||
| import jodd.http.HttpResponse; | ||||
| import jodd.http.ProxyInfo; | ||||
| import jodd.util.StringPool; | ||||
|  | ||||
| import me.chanjar.weixin.common.bean.result.WxError; | ||||
| import me.chanjar.weixin.common.exception.WxErrorException; | ||||
| import me.chanjar.weixin.common.util.http.RequestHttp; | ||||
| @ -35,6 +37,7 @@ public class JoddMediaImgUploadRequestExecutor extends MediaImgUploadRequestExec | ||||
|  | ||||
|     request.form("media", data); | ||||
|     HttpResponse response = request.send(); | ||||
|     response.charset(StringPool.UTF_8); | ||||
|     String responseContent = response.bodyText(); | ||||
|     WxError error = WxError.fromJson(responseContent); | ||||
|     if (error.getErrorCode() != 0) { | ||||
|  | ||||
| @ -5,6 +5,8 @@ import jodd.http.HttpRequest; | ||||
| import jodd.http.HttpResponse; | ||||
| import jodd.http.ProxyInfo; | ||||
| import jodd.util.MimeTypes; | ||||
| import jodd.util.StringPool; | ||||
|  | ||||
| import me.chanjar.weixin.common.bean.result.WxError; | ||||
| import me.chanjar.weixin.common.exception.WxErrorException; | ||||
| import me.chanjar.weixin.common.util.fs.FileUtils; | ||||
| @ -45,6 +47,7 @@ public class JoddQrCodeRequestExecutor extends QrCodeRequestExecutor<HttpConnect | ||||
|     request.withConnectionProvider(requestHttp.getRequestHttpClient()); | ||||
|  | ||||
|     HttpResponse response = request.send(); | ||||
|     response.charset(StringPool.UTF_8); | ||||
|     String contentTypeHeader = response.header("Content-Type"); | ||||
|     if (MimeTypes.MIME_TEXT_PLAIN.equals(contentTypeHeader)) { | ||||
|       String responseContent = response.bodyText(); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 ecoolper
					ecoolper