smtpapi 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 050a4386f549711615448ed588fe3252c2e29b9a
4
- data.tar.gz: 624cce44a9bccc779c18cb0e7da2a51d90cc1b72
3
+ metadata.gz: 63d928fcd070fe4c095e4a275cd9870bfa31c261
4
+ data.tar.gz: 3f6bfcaf8c9c683fe7cd52010da69c184e873b26
5
5
  SHA512:
6
- metadata.gz: c1c692a75f271cca7c646c8a417eed864d426030ddd20d3236269c7d984d9887e1ac2f378900e025ae73316b619065f03569953350abcebf74b6e04063ed1dfd
7
- data.tar.gz: ed184b2b534a24239260134b3c6513bd806a0650f81209755f842e6ca19f6986d01b88b5ea52ea23d74892fe60411d5ae9f600b5b8137d15f8ee988c629ba4bb
6
+ metadata.gz: 8d49b306832a949967a29afee9d07a918fa88245ceb7f02e47481ae5618bff128cac8b69056bd4a60228583c1fdfd036f97be0ac3c67863e943cc25a9b5466e8
7
+ data.tar.gz: 3c81b951a567c981b7276e4f7074d6b8b8a717e7a9ee64a94a99c23320694d382f3c5db1a5cbc08ff2cabd427934f6380f486d308992d1a4ebca9bcb4c9643e6
data/lib/smtpapi.rb CHANGED
@@ -125,7 +125,15 @@ module Smtpapi
125
125
  alias_method :to_json, :json_string
126
126
 
127
127
  def escape_unicode(str)
128
- str.unpack('U*').map{|i| i > 127 ? "\\u#{i.to_s(16)}" : i.chr("UTF-8")}.join
128
+ str.unpack('U*').map{|i|
129
+ if i > 65535 then
130
+ "\\u#{((i - 0x10000) / 0x400 + 0xD800).to_s(16)}\\u#{((i - 0x10000) % 0x400 + 0xDC00).to_s(16)}" if i > 65535
131
+ elsif i > 127 then
132
+ "\\u#{i.to_s(16)}"
133
+ else
134
+ i.chr("UTF-8")
135
+ end
136
+ }.join
129
137
  end
130
138
 
131
139
  end
@@ -1,3 +1,3 @@
1
1
  module Smtpapi
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
data/test/test.rb CHANGED
@@ -5,7 +5,7 @@ require "./lib/smtpapi"
5
5
  class SmtpapiTest < Test::Unit::TestCase
6
6
 
7
7
  def test_version
8
- assert_equal("0.0.8", Smtpapi::VERSION)
8
+ assert_equal("0.0.9", Smtpapi::VERSION)
9
9
  end
10
10
 
11
11
  def test_empty
@@ -110,6 +110,8 @@ class SmtpapiTest < Test::Unit::TestCase
110
110
  header.add_category('天破活殺') # category = ['天破活殺']
111
111
  header.add_category('天翔十字鳳') # category = ['天破活殺', '天翔十字鳳']
112
112
  assert_equal("{\"category\":[\"\\u5929\\u7834\\u6d3b\\u6bba\",\"\\u5929\\u7fd4\\u5341\\u5b57\\u9cf3\"]}",header.json_string)
113
+ header.add_category('鼖') # category = ['天破活殺', '天翔十字鳳', '鼖']
114
+ assert_equal("{\"category\":[\"\\u5929\\u7834\\u6d3b\\u6bba\",\"\\u5929\\u7fd4\\u5341\\u5b57\\u9cf3\",\"\\ud87e\\ude1b\"]}",header.json_string)
113
115
  end
114
116
 
115
117
  def test_sent_send_at
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smtpapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wataru Sato
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-18 00:00:00.000000000 Z
11
+ date: 2014-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler