htmlentities 4.2.0 → 4.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ == 4.2.1 (2010-04-05)
2
+ * Fixed error on Ruby 1.8.x when $KCODE was not set to "UTF8". Thanks to
3
+ Benoit Larroque for the bug report.
4
+
1
5
  == 4.2.0 (2009-08-24)
2
6
  * Added benchmarking code and improved performance.
3
7
 
@@ -33,13 +33,15 @@ class HTMLEntities
33
33
 
34
34
  def extended_entity_regexp
35
35
  @extended_entity_regexp ||= (
36
+ regexp_options = [nil]
36
37
  if encoding_aware?
37
38
  regexp = '[^\u{20}-\u{7E}]'
38
39
  else
39
40
  regexp = '[^\x20-\x7E]'
41
+ regexp_options << "U"
40
42
  end
41
43
  regexp += "|'" if @flavor == 'html4'
42
- Regexp.new(regexp)
44
+ Regexp.new(regexp, *regexp_options)
43
45
  )
44
46
  end
45
47
 
@@ -2,7 +2,7 @@ class HTMLEntities
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 4
4
4
  MINOR = 2
5
- TINY = 0
5
+ TINY = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -182,6 +182,18 @@ class HTMLEntities::EntitiesTest < Test::Unit::TestCase
182
182
  assert_decode([948].pack('U'), '&delta;')
183
183
  end
184
184
 
185
+ if RUBY_VERSION =~ /^1\.8\./
186
+ # Reported by Benoit Larroque
187
+ def test_should_encode_without_error_when_KCODE_is_not_UTF_8
188
+ kcode = $KCODE
189
+ $KCODE = "n"
190
+ coder = HTMLEntities.new;
191
+ text = [8212].pack('U')
192
+ assert_equal "&#8212;", coder.encode(text, :decimal)
193
+ $KCODE = kcode
194
+ end
195
+ end
196
+
185
197
  def test_should_ducktype_parameter_to_string_before_encoding
186
198
  pseudo_string = PseudoString.new('foo')
187
199
  assert_decode('foo', pseudo_string)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: htmlentities
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.0
4
+ version: 4.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Battley
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-11 00:00:00 +01:00
12
+ date: 2010-04-06 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -24,25 +24,25 @@ extra_rdoc_files:
24
24
  - History.txt
25
25
  - COPYING.txt
26
26
  files:
27
- - lib/htmlentities/decoder.rb
27
+ - lib/htmlentities/version.rb
28
+ - lib/htmlentities/flavors.rb
29
+ - lib/htmlentities/encoder.rb
30
+ - lib/htmlentities/legacy.rb
28
31
  - lib/htmlentities/mappings/html4.rb
29
32
  - lib/htmlentities/mappings/expanded.rb
30
33
  - lib/htmlentities/mappings/xhtml1.rb
31
- - lib/htmlentities/encoder.rb
32
- - lib/htmlentities/flavors.rb
33
- - lib/htmlentities/legacy.rb
34
- - lib/htmlentities/version.rb
34
+ - lib/htmlentities/decoder.rb
35
35
  - lib/htmlentities.rb
36
- - test/html4_test.rb
37
- - test/test_all.rb
36
+ - test/entities_test.rb
38
37
  - test/xhtml1_test.rb
39
38
  - test/roundtrip_test.rb
40
- - test/expanded_test.rb
41
39
  - test/legacy_test.rb
42
- - test/entities_test.rb
40
+ - test/expanded_test.rb
41
+ - test/test_all.rb
42
+ - test/html4_test.rb
43
+ - perf/profile.rb
43
44
  - perf/benchmark.rb
44
45
  - perf/performance.rb
45
- - perf/profile.rb
46
46
  - setup.rb
47
47
  - README.txt
48
48
  - History.txt