java的quoted-printable解码器源代码
来源:互联网 发布:求众数java 编辑:程序博客网 时间:2024/06/08 14:49
转自 http://www.qqread.com/java/c572396600.html
package test;import java.io.ByteArrayOutputStream;public class QuotedPrintable {public static void main(String[] args) {String a = "=BC=DA=A5=DF=A7Q=B3=A1=B8=A8=AE=E6=A1G[=AEi=C4=FD=B3]=ADp]HELLO INDUSTRY 4.0=A1A=A4u=B7~4.0=AE=C9=A5N=A5=BF=A6=A1=B1=D2=B0=CA=A1COLILY x OYA presents";String b = qpDecoding(a);System.out.println(b);}/** * QuotedPrintable 解码 * @param str * @return */public final static String qpDecoding(String str) {if (str == null) {return "";}try {str = str.replaceAll("=\n", "");byte[] bytes = str.getBytes("US-ASCII");for (int i = 0; i < bytes.length; i++) {byte b = bytes[i];if (b != 95) {bytes[i] = b;} else {bytes[i] = 32;}}if (bytes == null) {return "";}ByteArrayOutputStream buffer = new ByteArrayOutputStream();for (int i = 0; i < bytes.length; i++) {int b = bytes[i];if (b == '=') {try {int u = Character.digit((char) bytes[++i], 16);int l = Character.digit((char) bytes[++i], 16);if (u == -1 || l == -1) {continue;}buffer.write((char) ((u << 4) + l));} catch (ArrayIndexOutOfBoundsException e) {e.printStackTrace();}} else {buffer.write(b);}}return new String(buffer.toByteArray(), "big5");// big5} catch (Exception e) {e.printStackTrace();return "";}}}输出结果: 歐立利部落格:[展覽設計]HELLOINDUSTRY4.0,工業4.0時代正式啟動。OLILYxOYApresents
0 0
- java的quoted-printable解码器源代码
- 用于Quoted-Printable编解码的JAVA类
- Quoted-Printable
- C#导出VCF格式电话本,遇到QUOTED-PRINTABLE编码的问题,附带QUOTED-PRINTABLE编码解码
- quoted-printable decode
- MIME and Quoted-printable
- Quoted-Printable编码实现
- BASE64与Quoted-Printable
- Quoted-Printable编码
- base64/ascii/Quoted-printable
- Qt quoted Printable 解码
- 手动 BASE64 quoted-printable
- 邮件的另一种内容编码方式quoted-printable
- C# 对Quoted-Printable进行解码的方法
- Quoted-Printable Content-Transfer-Encoding
- quoted-printable 编码与解码
- eml之quoted-printable 解码
- Quoted-printable和Base64 编码
- ios关于view-viewcontroller页面之间的跳转的方法
- 前端开发之CSS布局模型
- HDU5025--Saving Tang Monk(BFS)
- 整点文艺的
- 指针和数组的一个例子
- java的quoted-printable解码器源代码
- MyBatis学习笔记(三)查询集合配置
- 如何找到最合适处理事件的UIView
- mysql cmd命令
- 在论坛中看到很多php新手朋友,苦于找不到好的文章或资料,对php无从下手。
- scoped_ptr.hpp
- UFFS文件系统与DFS关系
- 防止SYN泛洪攻击 开启路由器的TCP拦截
- 驱动支持多按键中断