escape_utils 1.1.0 → 1.1.1

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: a359a0da23b56ac37301e4ae73060dcfc4870d14
4
- data.tar.gz: 2a3c9ed36204fc638605f012c3ca5a87ccc756b3
3
+ metadata.gz: 9e8e894a1012e4b7e8f3faaa7a942a5ba2c1711d
4
+ data.tar.gz: 79c30477e80a0a3a1998f736ea63d83901a8d52f
5
5
  SHA512:
6
- metadata.gz: f862189c73f7858184a61a0e2ae78b2d344ac162022bd41ec77eb18eba6ae52a62e188d29b2b7ed2931ae47a4d6a33b2f8d6ecf82ef85e46ce1457e016897403
7
- data.tar.gz: 8f4a4643def62dfd8fdb27d9d631aa452bca3e63e1672a70bcf95594f98040ccee00276d6c0abd8e90c11126b7932b6e0efcce9e7d0b2881523b6faed62cad1b
6
+ metadata.gz: 6b8214e9b94dbc9cfc80de25aaa5e0e84262bc14cba81c5a682db42acfaa5197cc5fda8657afaf88ae7d930a2711df09ca6c431be65c78e4592eed4037c529cc
7
+ data.tar.gz: def42fd99a18ba77515d7ad53484bb815adfac586151a9072d1e238cc25853f86af85c44479e3232a3da587b4404c7cfe208d5be997d54e28f5d51420d0dc46d
@@ -118,6 +118,7 @@ static VALUE rb_eu_escape_html_as_html_safe(VALUE self, VALUE str)
118
118
  }
119
119
 
120
120
  rb_ivar_set(result, ID_at_html_safe, Qtrue);
121
+ rb_enc_associate(result, rb_enc_get(str));
121
122
 
122
123
  return result;
123
124
  }
@@ -1,3 +1,3 @@
1
1
  module EscapeUtils
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
@@ -4,6 +4,30 @@ class MyCustomHtmlSafeString < String
4
4
  end
5
5
 
6
6
  class HtmlEscapeTest < Minitest::Test
7
+ def test_escape_source_encoding_is_maintained
8
+ source = 'foobar'
9
+ str = EscapeUtils.escape_html_as_html_safe(source)
10
+ assert_equal source.encoding, str.encoding
11
+ end
12
+
13
+ def test_escape_binary_encoding_is_maintained
14
+ source = 'foobar'.b
15
+ str = EscapeUtils.escape_html_as_html_safe(source)
16
+ assert_equal source.encoding, str.encoding
17
+ end
18
+
19
+ def test_escape_uft8_encoding_is_maintained
20
+ source = 'foobar'.encode 'UTF-8'
21
+ str = EscapeUtils.escape_html_as_html_safe(source)
22
+ assert_equal source.encoding, str.encoding
23
+ end
24
+
25
+ def test_escape_us_ascii_encoding_is_maintained
26
+ source = 'foobar'.encode 'US-ASCII'
27
+ str = EscapeUtils.escape_html_as_html_safe(source)
28
+ assert_equal source.encoding, str.encoding
29
+ end
30
+
7
31
  def test_escape_basic_html_with_secure
8
32
  assert_equal "&lt;some_tag&#47;&gt;", EscapeUtils.escape_html("<some_tag/>")
9
33
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: escape_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Lopez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-25 00:00:00.000000000 Z
11
+ date: 2016-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
@@ -207,7 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
207
207
  version: '0'
208
208
  requirements: []
209
209
  rubyforge_project:
210
- rubygems_version: 2.2.2
210
+ rubygems_version: 2.5.1
211
211
  signing_key:
212
212
  specification_version: 4
213
213
  summary: Faster string escaping routines for your web apps