utf8_validator 1.0.2 → 1.0.3

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.
data/README.rdoc CHANGED
@@ -29,6 +29,8 @@ Other interesting and/or useful information can be found:
29
29
 
30
30
  It is expected that this validator will be used in Ruby environments prior to 1.9.x. However, nothing prohibits use with Ruby 1.9. Tests recognize a 1.9 environment, and insure that 1.9 native behavior matches the validator behavior.
31
31
 
32
+ Testing done with 1.8.6 and 1.8.7.
33
+
32
34
  == Reporting Issues
33
35
 
34
36
  Please report issues on the tracker at github:
data/Rakefile CHANGED
@@ -45,7 +45,8 @@ end
45
45
 
46
46
  task :default => :test
47
47
 
48
- require 'rake/rdoctask'
48
+ # require 'rake/rdoctask'
49
+ require 'rdoc/task'
49
50
  Rake::RDocTask.new do |rdoc|
50
51
  version = File.exist?('VERSION') ? File.read('VERSION') : ""
51
52
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.2
1
+ 1.0.3
@@ -89,7 +89,15 @@ class Validator
89
89
  # and the location of that byte are described in the error message.
90
90
  #
91
91
  def valid_encoding?(string, raise_on_error = false)
92
- bytes = string.bytes
92
+ case RUBY_VERSION
93
+ when /1\.8\.[56]/
94
+ bytes = []
95
+ 0.upto(string.length-1) {|i|
96
+ bytes << string[i]
97
+ }
98
+ else
99
+ bytes = string.bytes
100
+ end
93
101
  #
94
102
  valid = true
95
103
  index = -1
@@ -114,6 +122,7 @@ class Validator
114
122
  #
115
123
  when "start"
116
124
  puts "state: start" if DEBUG
125
+ puts "next_byte: #{next_byte}" if DEBUG
117
126
  case next_byte
118
127
 
119
128
  # ASCII
@@ -278,6 +287,7 @@ class Validator
278
287
  end
279
288
  #
280
289
  puts "State at end: #{state}" if DEBUG
290
+ puts "Valid at end: #{valid}" if DEBUG
281
291
  # Catch truncation at end of string
282
292
  if valid and state != 'start'
283
293
  puts "Resetting valid value" if DEBUG
@@ -114,6 +114,8 @@ class TestUtf8Validator < Test::Unit::TestCase
114
114
  def test_0080_interesting_valid_strings
115
115
  test_data = [
116
116
  "“Iñtërnâtiônàlizætiøn”", # A suggestion from the net
117
+ "\xd0\x9b\xd0\x93\xd0\xa2\xd0\x9c", # An interesting Russian string from the 'go' guys ....
118
+ "\xd0\x9bГТМ", # A variation on that
117
119
  ]
118
120
  test_data.each do |string|
119
121
  assert @validator.valid_encoding?(string), "interesting valid strings: #{string}"
@@ -4,15 +4,14 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{utf8_validator}
8
- s.version = "1.0.2"
7
+ s.name = "utf8_validator"
8
+ s.version = "1.0.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = [%q{Guy Allard}]
12
- s.date = %q{2011-08-22}
13
- s.description = %q{A State Machine implementation of a UTF-8 Encoding
14
- Validation algorithm.}
15
- s.email = %q{allard.guy.m@gmail.com}
11
+ s.authors = ["Guy Allard"]
12
+ s.date = "2011-11-29"
13
+ s.description = "A State Machine implementation of a UTF-8 Encoding \nValidation algorithm."
14
+ s.email = "allard.guy.m@gmail.com"
16
15
  s.extra_rdoc_files = [
17
16
  "LICENSE.txt",
18
17
  "README.rdoc"
@@ -32,11 +31,11 @@ Validation algorithm.}
32
31
  "test/test_utf8_validator.rb",
33
32
  "utf8_validator.gemspec"
34
33
  ]
35
- s.homepage = %q{http://github.com/gmallard/utf8_validator}
36
- s.licenses = [%q{MIT}]
37
- s.require_paths = [%q{lib}]
38
- s.rubygems_version = %q{1.8.6.1}
39
- s.summary = %q{A UTF-8 Encoding Validator.}
34
+ s.homepage = "http://github.com/gmallard/utf8_validator"
35
+ s.licenses = ["MIT"]
36
+ s.require_paths = ["lib"]
37
+ s.rubygems_version = "1.8.11"
38
+ s.summary = "A UTF-8 Encoding Validator."
40
39
 
41
40
  if s.respond_to? :specification_version then
42
41
  s.specification_version = 3
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: utf8_validator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-22 00:00:00.000000000 Z
12
+ date: 2011-11-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
16
- requirement: &13947440 !ruby/object:Gem::Requirement
16
+ requirement: &9622620 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.0.0
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *13947440
24
+ version_requirements: *9622620
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: jeweler
27
- requirement: &13946960 !ruby/object:Gem::Requirement
27
+ requirement: &9621220 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.5.2
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *13946960
35
+ version_requirements: *9621220
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rcov
38
- requirement: &13946480 !ruby/object:Gem::Requirement
38
+ requirement: &9620000 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *13946480
46
+ version_requirements: *9620000
47
47
  description: ! "A State Machine implementation of a UTF-8 Encoding \nValidation algorithm."
48
48
  email: allard.guy.m@gmail.com
49
49
  executables: []
@@ -80,7 +80,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
80
80
  version: '0'
81
81
  segments:
82
82
  - 0
83
- hash: 128590330687623386
83
+ hash: -4241064527396142925
84
84
  required_rubygems_version: !ruby/object:Gem::Requirement
85
85
  none: false
86
86
  requirements:
@@ -89,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
89
  version: '0'
90
90
  requirements: []
91
91
  rubyforge_project:
92
- rubygems_version: 1.8.6.1
92
+ rubygems_version: 1.8.11
93
93
  signing_key:
94
94
  specification_version: 3
95
95
  summary: A UTF-8 Encoding Validator.