在Ruby / Javascript中解码引号的可打印字符串 [英] Decode Quoted-printable strings in Ruby / Javascript

查看:149
本文介绍了在Ruby / Javascript中解码引号的可打印字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Ruby邮件库 https://github.com/mikel/mail/

I am using the Ruby mail library https://github.com/mikel/mail/

我正在寻找解码引用可打印字符串的解决方案(使用此库或本地Ruby函数)

I am looking for a solution to decode Quoted-printable strings (using this library or natives Ruby function)

我的Ruby版本是ruby 1.9.2p294

My Ruby version is ruby 1.9.2p294

客户端的任何Javascript解决方案也很好。

Any solution in Javascript from client side is also good.

任何线索?

推荐答案

您将能够通过 decodeURIComponent(str.replace(/ / g,'%'))

在Javascript中测试代码 / p>

Test code in Javascript:

var input = 'Hello! in Korean is: =EC=95=88=EB=85=95=ED=95=98=EC=84=B8=EC=9A=94!';
var output = decodeURIComponent(input.replace(/=/g,'%'));

document.writeln(output);

输出:

Output:

Hello! in Korean is: 안녕하세요!

在线尝试此代码这里

这篇关于在Ruby / Javascript中解码引号的可打印字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆