ultra7 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 555011104f1136cd2db5802f51321b784a79bf3d
4
- data.tar.gz: 49de6c0f2744b7b1fdb6f2053c775a0b689ac699
3
+ metadata.gz: 4b3d743cab74270eb2689c1d2f0bdfa870d34556
4
+ data.tar.gz: ff87b1329b6d69f7152d27b7e015bdba3ef017c3
5
5
  SHA512:
6
- metadata.gz: 5a6bf087db91087c18ea8b469208d7eb314f526456b73dc62d5ee02e5c924c3698a190c9ab284a188be73ac39d1827b562a7825348c126a01f99ee5eae52ebd9
7
- data.tar.gz: 40e87e21c246626f03b33c7b86b6fb815e03a4a51f9051fe51fecdd35beb492b707bd092fc1c996dc7b184358b9c2065f48376c20209d5949643145a51e8ee7b
6
+ metadata.gz: 914d2bc423738e3b25e14d1d51e8f10562a39a0b2f9fb07936075169b060c5032528944a4889d0480fbceb6935237a32f6e5fd2f0278dfe8dc03914cdd84dd99
7
+ data.tar.gz: f0918fb057780da088754f04b4bcc560e678c10292e59bb5203698c95e1b1cdf6045163e3df9f04d6479ce0379cd5623c2dd75f0f1c3b964babaa310e0bef004
data/CHANGELOG CHANGED
@@ -1,5 +1,7 @@
1
1
  ## CHANGELOG
2
2
 
3
+ - __2014/12/14__: 0.3.0 release.
4
+ - Slight enhancement to MIME encoded-word handling.
3
5
 
4
6
  - __2014/12/14__: 0.2.0 release.
5
7
  - Enhancements to deal with encoding marker.
data/README.md CHANGED
@@ -3,9 +3,9 @@ A UTF-7 MIME header decoder, plain and simple.
3
3
 
4
4
  ## What is Ultra7?
5
5
 
6
- * Ultra7 is a UTF-7 decoder for MIME headers, unlike `Net::IMAP.decode_utf7`
7
- which is meant for decoding mailbox names.
8
- * `Ultra7::MIME` is also a a mixin, so you can conveniently combine it in another class by using
6
+ * Ultra7 is a UTF-7 decoder for MIME message header names and values, per the MIME [encoded word syntax of RFC-2047](http://tools.ietf.org/html/rfc2047),
7
+ * It is almost unlike [`Net::IMAP.decode_utf7`](http://ruby-doc.org/stdlib-2.0.0/libdoc/net/imap/rdoc/Net/IMAP.html#method-c-decode_utf7), which is meant for decoding mailbox names.
8
+ * `Ultra7::MIME` is also a mixin, so you can conveniently combine it in another class by using
9
9
  `include`.
10
10
  * Read the [API documentation](http://www.rubydoc.info/gems/ultra7).
11
11
  * Learn more about [Ultra7 at bitbucket](https://bitbucket.org/buruzaemon/ultra7/).
@@ -25,7 +25,7 @@ which is meant for decoding mailbox names.
25
25
 
26
26
  ## Usage
27
27
 
28
- * Using Ultra7 is pretty straight-forward, really. It _only_ decode UTF-7.
28
+ * Using Ultra7 is pretty straight-forward, really. It _only_ decodes UTF-7.
29
29
 
30
30
  require 'ultra7'
31
31
 
@@ -43,6 +43,7 @@ which is meant for decoding mailbox names.
43
43
  Ultra7::MIME.decode_utf7(subject, encoding: 'UTF-8')
44
44
  => "배달 상태 알림(실패)"
45
45
 
46
+
46
47
  * And you can use `Ultra7::MIME` as a mixin.
47
48
 
48
49
  # As a mixin to another class
@@ -18,18 +18,18 @@ module Ultra7
18
18
  # @param [Hash] options
19
19
  # @return [String] UTF-7 decoded value
20
20
  # @raise [ArgumentError] if text other than UTF-7 are passed in, or the given `encoding` cannot be found
21
- # convert UTF-7
22
21
  def self.decode_utf7(text, options={encoding: nil})
23
22
  # only deal with UTF-7 encoding
24
- text.scan(/=\?(.*)\?[qb]\?/i).each {
23
+ text.scan(/=\?(.*)\?[q]\?/i).each {
25
24
  e = $1
26
25
  if e and !(e=~/utf\-7/i)
27
26
  raise ArgumentError.new("Cannot decode #{e} as UTF-7!")
28
27
  end
29
28
  }
30
29
 
31
- # remove any encoding start/end markers
32
- text = text.gsub(/\?=/, '').gsub(/=\?[^?]*utf\-7\?[qb]\?/i, '')
30
+ # remove any opening charset and Q-encoding start/end markers
31
+ # for MIME encoded words
32
+ text = text.gsub(/\?=/, '').gsub(/=\?[^?]*utf\-7\?[q]\?/i, '')
33
33
 
34
34
  enc = options[:encoding].nil? \
35
35
  ? Encoding.default_external \
@@ -7,7 +7,7 @@
7
7
  # It may be used as a mixin.
8
8
  module Ultra7
9
9
  # Version string for this Rubygem.
10
- VERSION = "0.2.0"
10
+ VERSION = "0.3.0"
11
11
  end
12
12
 
13
13
  # Copyright (c) 2014-2015, Brooke M. Fujita.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ultra7
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke M. Fujita
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-13 00:00:00.000000000 Z
11
+ date: 2014-12-14 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
14
  ultra7 decodes UTF-7 in the context of MIME headers (c.f. https://tools.ietf.org/html/rfc2152).