mirror of
				https://gitee.com/binary/weixin-java-tools.git
				synced 2025-10-31 18:46:10 +08:00 
			
		
		
		
	替换hard code
This commit is contained in:
		| @ -27,6 +27,8 @@ import me.chanjar.weixin.mp.bean.*; | |||||||
| import me.chanjar.weixin.mp.bean.result.*; | import me.chanjar.weixin.mp.bean.result.*; | ||||||
| import me.chanjar.weixin.mp.util.http.*; | import me.chanjar.weixin.mp.util.http.*; | ||||||
| import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | ||||||
|  |  | ||||||
|  | import org.apache.commons.io.Charsets; | ||||||
| import org.apache.http.Consts; | import org.apache.http.Consts; | ||||||
| import org.apache.http.HttpHost; | import org.apache.http.HttpHost; | ||||||
| import org.apache.http.client.ClientProtocolException; | import org.apache.http.client.ClientProtocolException; | ||||||
| @ -48,6 +50,7 @@ import java.io.InputStream; | |||||||
| import java.io.StringReader; | import java.io.StringReader; | ||||||
| import java.io.UnsupportedEncodingException; | import java.io.UnsupportedEncodingException; | ||||||
| import java.net.URLEncoder; | import java.net.URLEncoder; | ||||||
|  | import java.nio.charset.Charset; | ||||||
| import java.security.NoSuchAlgorithmException; | import java.security.NoSuchAlgorithmException; | ||||||
| import java.util.*; | import java.util.*; | ||||||
| import java.util.Map.Entry; | import java.util.Map.Entry; | ||||||
| @ -478,7 +481,7 @@ public class WxMpServiceImpl implements WxMpService { | |||||||
|   public String qrCodePictureUrl(String ticket) throws WxErrorException { |   public String qrCodePictureUrl(String ticket) throws WxErrorException { | ||||||
|     String url = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=%s"; |     String url = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=%s"; | ||||||
|     try { |     try { | ||||||
|       return String.format(url, URLEncoder.encode(ticket, "utf-8")); |       return String.format(url, URLEncoder.encode(ticket, Charsets.UTF_8.name())); | ||||||
|     } catch (UnsupportedEncodingException e) { |     } catch (UnsupportedEncodingException e) { | ||||||
|       WxError error = new WxError(); |       WxError error = new WxError(); | ||||||
|       error.setErrorCode(-1); |       error.setErrorCode(-1); | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user