ansel 2.0.2 → 3.0.0
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/LICENSE +1 -1
- data/README.md +8 -15
- data/ansel.gemspec +6 -5
- data/lib/ansel/converter.rb +4 -3
- data/lib/ansel/version.rb +1 -1
- metadata +9 -13
- data/Gemfile +0 -8
- data/Gemfile.lock +0 -51
- data/Gemfile.travis +0 -7
- data/Gemfile.travis19 +0 -7
- data/Rakefile +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a438c0b694602e095a0be5413fee3dcd46de00243861cb9524f24a40b79f5910
|
4
|
+
data.tar.gz: 566a2b1f0f61f981daa498be57ce4d56d09d27bb821984385324bb8c5593746e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c78756e7f02448114ec87561b49972061b7e03156c49f5c54b99b2397daa5fa4346a473e229fe97620c3a9743556d132c92c0edc6fcd9696db84fd7b3e32492c
|
7
|
+
data.tar.gz: 0ef49f32f68a0b1ad5b42840692abf033288f32475a97ea5c88f8d4ab0a1420d2f36ae56086909c6d0baa0380eabdb1d90dea67c6284ffcf310009083b33c987
|
data/CHANGELOG.md
CHANGED
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,14 +1,12 @@
|
|
1
1
|
# ANSEL
|
2
2
|
|
3
3
|
[](https://rubygems.org/gems/ansel)
|
4
|
-
[](https://github.com/infused/ansel/actions/workflows/build.yml)
|
5
5
|
[](https://rubygems.org/gems/ansel/)
|
6
6
|
[](https://github.com/infused/ansel)
|
7
7
|
|
8
8
|
ANSEL provides character set conversion from ANSEL to UTF-8
|
9
9
|
|
10
|
-
Copyright (c) 2006-2019 Keith Morrison <mailto:keithm@infused.org>, <http://www.infused.org>
|
11
|
-
|
12
10
|
- Project page: <http://github.com/infused/ansel>
|
13
11
|
- API Documentation: <http://rubydoc.info/github/infused/ansel/>
|
14
12
|
- Report bugs: <http://github.com/infused/ansel/issues>
|
@@ -17,18 +15,13 @@ Copyright (c) 2006-2019 Keith Morrison <mailto:keithm@infused.org>, <http://www.
|
|
17
15
|
|
18
16
|
## Compatibility
|
19
17
|
|
20
|
-
ANSEL is
|
18
|
+
ANSEL is compatible with the following Rubies:
|
21
19
|
|
22
|
-
*
|
23
|
-
* 2.
|
24
|
-
*
|
25
|
-
* 2.2.x
|
26
|
-
* 2.3.x
|
27
|
-
* 2.4.x
|
28
|
-
* 2.5.x
|
29
|
-
* jruby 1.7+
|
20
|
+
* 3.1.x
|
21
|
+
* 3.2.x
|
22
|
+
* 3.3.x
|
30
23
|
|
31
|
-
If you need ANSEL
|
24
|
+
If you need ANSEL conversion in Ruby 1.8, see my [ansel_iconv](http://github.com/infused/ansel_iconv) project.
|
32
25
|
|
33
26
|
## Installation
|
34
27
|
|
@@ -54,9 +47,9 @@ encodings supported by the [Gedcom
|
|
54
47
|
5.5](http://homepages.rootsweb.ancestry.com/~pmcbride/gedcom/55gctoc.htm)
|
55
48
|
standard.
|
56
49
|
|
57
|
-
## LICENSE
|
50
|
+
## LICENSE
|
58
51
|
|
59
|
-
Copyright (c) 2006-
|
52
|
+
Copyright (c) 2006-2024 Keith Morrison <keithm@infused.org>
|
60
53
|
|
61
54
|
Permission is hereby granted, free of charge, to any person obtaining
|
62
55
|
a copy of this software and associated documentation files (the
|
data/ansel.gemspec
CHANGED
@@ -1,23 +1,24 @@
|
|
1
1
|
# encoding: ascii-8bit
|
2
2
|
|
3
|
-
lib = File.expand_path('
|
4
|
-
|
3
|
+
lib = File.expand_path('lib/', __dir__)
|
4
|
+
$LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib)
|
5
5
|
require 'ansel/version'
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = 'ansel'
|
9
9
|
s.version = ANSEL::VERSION
|
10
|
-
s.authors = [
|
10
|
+
s.authors = ['Keith Morrison']
|
11
11
|
s.email = 'keithm@infused.org'
|
12
12
|
s.homepage = 'http://github.com/infused/ansel'
|
13
13
|
s.summary = 'Convert ANSEL encoded text to UTF-8'
|
14
14
|
s.description = 'Convert ANSEL encoded text to UTF-8'
|
15
|
+
s.license = 'MIT'
|
15
16
|
|
16
17
|
s.rdoc_options = ['--charset=UTF-8']
|
17
18
|
s.extra_rdoc_files = ['README.md', 'CHANGELOG.md', 'LICENSE']
|
18
|
-
s.files = Dir['
|
19
|
-
s.test_files = Dir.glob('test/**/*_test.rb')
|
19
|
+
s.files = Dir['README.md', 'CHANGELOG.md', 'LICENSE', 'lib/**/*', 'ansel.gemspec']
|
20
20
|
s.require_paths = ['lib']
|
21
21
|
|
22
22
|
s.required_rubygems_version = '>= 1.3.0'
|
23
|
+
s.required_ruby_version = '>= 3.1.0'
|
23
24
|
end
|
data/lib/ansel/converter.rb
CHANGED
@@ -18,7 +18,7 @@ module ANSEL
|
|
18
18
|
scanner = StringScanner.new(string)
|
19
19
|
until scanner.eos?
|
20
20
|
byte = scanner.get_byte
|
21
|
-
char = byte.
|
21
|
+
char = byte.unpack1('C')
|
22
22
|
char_hex = char.to_s(16).upcase
|
23
23
|
|
24
24
|
case char
|
@@ -26,20 +26,21 @@ module ANSEL
|
|
26
26
|
output << byte
|
27
27
|
when 0x88..0xC8
|
28
28
|
output << utf16_to_utf8(ANSI_TO_UTF16_MAP[char_hex] || ANSI_TO_UTF16_MAP['ERR'])
|
29
|
-
|
29
|
+
scanner.get_byte if scanner.check(/\00/)
|
30
30
|
when 0xE0..0xFB
|
31
31
|
[2, 1, 0].each do |n| # try 3 bytes, then 2 bytes, then 1 byte
|
32
32
|
bytes = [char_hex]
|
33
33
|
scanner.peek(n).each_byte { |b| bytes << b.to_s(16).upcase }
|
34
34
|
hex_key = bytes.join('+')
|
35
35
|
next unless ANSI_TO_UTF16_MAP.key?(hex_key)
|
36
|
+
|
36
37
|
output << utf16_to_utf8(ANSI_TO_UTF16_MAP[hex_key])
|
37
38
|
n.times { scanner.get_byte }
|
38
39
|
break
|
39
40
|
end
|
40
41
|
else
|
41
42
|
output << utf16_to_utf8(ANSI_TO_UTF16_MAP['ERR'])
|
42
|
-
scanner.get_byte if scanner.get_byte.
|
43
|
+
scanner.get_byte if scanner.get_byte.unpack1('C') >= 0xE0 # ignore the next byte
|
43
44
|
end
|
44
45
|
end
|
45
46
|
|
data/lib/ansel/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ansel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keith Morrison
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Convert ANSEL encoded text to UTF-8
|
14
14
|
email: keithm@infused.org
|
@@ -20,22 +20,18 @@ extra_rdoc_files:
|
|
20
20
|
- LICENSE
|
21
21
|
files:
|
22
22
|
- CHANGELOG.md
|
23
|
-
- Gemfile
|
24
|
-
- Gemfile.lock
|
25
|
-
- Gemfile.travis
|
26
|
-
- Gemfile.travis19
|
27
23
|
- LICENSE
|
28
24
|
- README.md
|
29
|
-
- Rakefile
|
30
25
|
- ansel.gemspec
|
31
26
|
- lib/ansel.rb
|
32
27
|
- lib/ansel/character_map.rb
|
33
28
|
- lib/ansel/converter.rb
|
34
29
|
- lib/ansel/version.rb
|
35
30
|
homepage: http://github.com/infused/ansel
|
36
|
-
licenses:
|
31
|
+
licenses:
|
32
|
+
- MIT
|
37
33
|
metadata: {}
|
38
|
-
post_install_message:
|
34
|
+
post_install_message:
|
39
35
|
rdoc_options:
|
40
36
|
- "--charset=UTF-8"
|
41
37
|
require_paths:
|
@@ -44,15 +40,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
44
40
|
requirements:
|
45
41
|
- - ">="
|
46
42
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
43
|
+
version: 3.1.0
|
48
44
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
45
|
requirements:
|
50
46
|
- - ">="
|
51
47
|
- !ruby/object:Gem::Version
|
52
48
|
version: 1.3.0
|
53
49
|
requirements: []
|
54
|
-
rubygems_version: 3.
|
55
|
-
signing_key:
|
50
|
+
rubygems_version: 3.5.3
|
51
|
+
signing_key:
|
56
52
|
specification_version: 4
|
57
53
|
summary: Convert ANSEL encoded text to UTF-8
|
58
54
|
test_files: []
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
ansel (2.0.1)
|
5
|
-
|
6
|
-
GEM
|
7
|
-
remote: https://rubygems.org/
|
8
|
-
specs:
|
9
|
-
ast (2.4.0)
|
10
|
-
byebug (10.0.2)
|
11
|
-
diff-lcs (1.2.5)
|
12
|
-
jaro_winkler (1.5.2)
|
13
|
-
parallel (1.13.0)
|
14
|
-
parser (2.6.0.0)
|
15
|
-
ast (~> 2.4.0)
|
16
|
-
powerpack (0.1.2)
|
17
|
-
rainbow (3.0.0)
|
18
|
-
rspec (3.1.0)
|
19
|
-
rspec-core (~> 3.1.0)
|
20
|
-
rspec-expectations (~> 3.1.0)
|
21
|
-
rspec-mocks (~> 3.1.0)
|
22
|
-
rspec-core (3.1.7)
|
23
|
-
rspec-support (~> 3.1.0)
|
24
|
-
rspec-expectations (3.1.2)
|
25
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
26
|
-
rspec-support (~> 3.1.0)
|
27
|
-
rspec-mocks (3.1.3)
|
28
|
-
rspec-support (~> 3.1.0)
|
29
|
-
rspec-support (3.1.2)
|
30
|
-
rubocop (0.63.1)
|
31
|
-
jaro_winkler (~> 1.5.1)
|
32
|
-
parallel (~> 1.10)
|
33
|
-
parser (>= 2.5, != 2.5.1.1)
|
34
|
-
powerpack (~> 0.1)
|
35
|
-
rainbow (>= 2.2.2, < 4.0)
|
36
|
-
ruby-progressbar (~> 1.7)
|
37
|
-
unicode-display_width (~> 1.4.0)
|
38
|
-
ruby-progressbar (1.10.0)
|
39
|
-
unicode-display_width (1.4.1)
|
40
|
-
|
41
|
-
PLATFORMS
|
42
|
-
ruby
|
43
|
-
|
44
|
-
DEPENDENCIES
|
45
|
-
ansel!
|
46
|
-
byebug
|
47
|
-
rspec
|
48
|
-
rubocop
|
49
|
-
|
50
|
-
BUNDLED WITH
|
51
|
-
1.17.2
|
data/Gemfile.travis
DELETED
data/Gemfile.travis19
DELETED
data/Rakefile
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# encoding: ascii-8bit
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'bundler/setup';
|
5
|
-
Bundler.setup(:default, :development)
|
6
|
-
|
7
|
-
require 'rspec/core/rake_task'
|
8
|
-
RSpec::Core::RakeTask.new :spec do |t|
|
9
|
-
t.rspec_opts = %w(--color)
|
10
|
-
end
|
11
|
-
|
12
|
-
task :default => :spec
|
13
|
-
|
14
|
-
desc "Open an irb session preloaded with this library"
|
15
|
-
task :console do
|
16
|
-
sh "irb -rubygems -I lib -r ansel.rb"
|
17
|
-
end
|