Java Code Examples for cn.hutool.core.util.CharsetUtil#CHARSET_UTF_8
The following examples show how to use
cn.hutool.core.util.CharsetUtil#CHARSET_UTF_8 .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HtHttpUtil.java From SubTitleSearcher with Apache License 2.0 | 5 votes |
/** * 获取头部文件名配置 Content-Disposition=[attachment; * filename="Downsizing.2017.1080p.Bluray.MKV.x264.AC3.ass"] * * @param resp * @return */ public static String getFileName(HttpResponse resp) { String desp = new String(resp.header("Content-Disposition").getBytes(CharsetUtil.CHARSET_ISO_8859_1), CharsetUtil.CHARSET_UTF_8); if (desp == null || desp.indexOf("filename") == -1) return null; return RegexUtil.getMatchStr(desp, "filename=\"([^\"]+)\""); }
Example 2
Source File: SshModel.java From Jpom with MIT License | 5 votes |
public Charset getCharsetT() { Charset charset; try { charset = Charset.forName(this.getCharset()); } catch (Exception e) { charset = CharsetUtil.CHARSET_UTF_8; } return charset; }
Example 3
Source File: JpomApplication.java From Jpom with MIT License | 5 votes |
/** * 获取当前系统编码 * * @return charset */ public static Charset getCharset() { if (charset == null) { if (SystemUtil.getOsInfo().isLinux()) { charset = CharsetUtil.CHARSET_UTF_8; } else if (SystemUtil.getOsInfo().isMac()) { charset = CharsetUtil.CHARSET_UTF_8; } else { charset = CharsetUtil.CHARSET_GBK; } } return charset; }
Example 4
Source File: FileTailWatcherRun.java From Jpom with MIT License | 5 votes |
FileTailWatcherRun(File file, LineHandler lineHandler) throws IOException { this.lineHandler = lineHandler; this.randomFile = new RandomAccessFile(file, FileMode.r.name()); Charset detSet = ExtConfigBean.getInstance().getLogFileCharset(); if (detSet == null) { detSet = CharsetUtil.charset(new CharsetDetector().detectChineseCharset(file)); detSet = (detSet == StandardCharsets.US_ASCII) ? CharsetUtil.CHARSET_UTF_8 : detSet; } this.charset = detSet; if (file.length() > 0) { // 开始读取 this.startRead(); } }
Example 5
Source File: HtHttpUtil.java From SubTitleSearcher with Apache License 2.0 | 5 votes |
/** * 获取头部文件名配置 Content-Disposition=[attachment; * filename="Downsizing.2017.1080p.Bluray.MKV.x264.AC3.ass"] * * @param resp * @return */ public static String getFileName(HttpResponse resp) { String desp = new String(resp.header("Content-Disposition").getBytes(CharsetUtil.CHARSET_ISO_8859_1), CharsetUtil.CHARSET_UTF_8); if (desp == null || desp.indexOf("filename") == -1) return null; return RegexUtil.getMatchStr(desp, "filename=\"([^\"]+)\""); }
Example 6
Source File: TestUtil.java From albedo with GNU Lesser General Public License v3.0 | 5 votes |
public static String toParams(Map<String, ?> paramMap) { if (CollectionUtil.isEmpty(paramMap)) { return StrUtil.EMPTY; } Charset charset = CharsetUtil.CHARSET_UTF_8; final StringBuilder sb = new StringBuilder(); boolean isFirst = true, isFristTwo = true; String key; Object value; for (Map.Entry<String, ?> item : paramMap.entrySet()) { if (isFirst) { isFirst = false; } else { sb.append("&"); } key = item.getKey(); if (StrUtil.isNotEmpty(key)) { value = item.getValue(); if (value instanceof Collection) { for (Object obj : (Collection) value) { if (isFristTwo) { isFristTwo = false; } else { sb.append("&"); } appendUrl(sb, obj, key, charset); } } else { appendUrl(sb, value, key, charset); } } } return sb.toString(); }
Example 7
Source File: ConfigBaseUtil.java From MooTool with MIT License | 4 votes |
ConfigBaseUtil() { setting = new Setting(FileUtil.touch(settingFilePath), CharsetUtil.CHARSET_UTF_8, false); }
Example 8
Source File: ConfigBaseUtil.java From WePush with MIT License | 4 votes |
ConfigBaseUtil() { setting = new Setting(FileUtil.touch(settingFilePath), CharsetUtil.CHARSET_UTF_8, false); }