ansel_iconv 1.1.6 → 1.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d593449dba631156ac82a8f1581ea9c769578fd8f74c3c9192157f03625465a4
4
+ data.tar.gz: fbaa3bb8e75684b9539d6140f634d1013bfbda5320c85b8b0bd0105015fedded
5
+ SHA512:
6
+ metadata.gz: 034c69a1ba0621b2b0c4da10796d5b80d9c25582d0a03d2366ebf52848e099231663371a9ea1662477b8bb1c64c2a3b3a854f19422a0cafa6a2765641a6df5e3
7
+ data.tar.gz: 617a594283bf4e8bfc706f0bf8166823372b9ceeba2c3038a286425d20d351ae204ed82dff8c0c9536136a0b69229b817910b7d70e71b38782cc97742b178244
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 1.1.7
2
+ Exclude unnecessary files from the gem
3
+
1
4
  ## 1.1.6
2
5
 
3
6
  - Remove dependency on activesupport
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009-2010 Keith Morrison <keithm@infused.org>
1
+ Copyright (c) 2009-2012 Keith Morrison <keithm@infused.org>
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,42 +1,49 @@
1
1
  # ANSEL::Iconv
2
2
 
3
+ [![Version](http://img.shields.io/gem/v/ansel_iconv.svg?style=flat)](https://rubygems.org/gems/ansel_iconv)
4
+ [![License](https://img.shields.io/github/license/infused/ansel_iconv.svg)](https://github.com/infused/ansel_iconv)
5
+
6
+
3
7
  ANSEL::Iconv is a wrapper for Iconv that adds ANSEL character set conversion.
4
8
 
5
- Copyright (c) 2006-2010 Keith Morrison <mailto:keithm@infused.org>, <http://www.infused.org>
9
+ Copyright (c) 2006-2015 Keith Morrison <mailto:keithm@infused.org>, <http://www.infused.org>
6
10
 
7
11
  - Project page: <http://github.com/infused/ansel_iconv>
8
- - API Documentation: <http://rubydoc.info/github/infused/ansel_iconv/frames>
12
+ - API Documentation: <http://rubydoc.info/github/infused/ansel_iconv>
9
13
  - Report bugs: <http://github.com/infused/ansel_iconv/issues>
10
14
  - Questions? Email [keithm@infused.org](mailto:keithm@infused.org?subject=ANSEL::Iconv)
11
15
  with ANSEL::Iconv in the subject line
12
-
16
+
13
17
  ## Compatibility
14
18
 
15
- ANSEL::Iconv is compatible with Ruby 1.8.6, 1.8.7, and 1.9.2
19
+ ANSEL::Iconv is compatible with Ruby 1.8.6 and 1.8.7. Ruby must
20
+ be compiled with iconv support.
21
+
22
+ For ANSEL conversion under Ruby 1.9 and higher see my [ANSEL](https://github.com/infused/ansel) gem.
16
23
 
17
24
  ## Installation
18
25
 
19
26
  gem install ansel_iconv
20
-
27
+
21
28
  ## Basic Usage
22
29
 
23
- Conversion from ANSEL to any other encoding is fully supported, but you cannot
30
+ Conversion from ANSEL to any other encoding is fully supported, but you cannot
24
31
  convert to ANSEL from another encoding. Two-way encoding may be added
25
32
  in the future.
26
-
33
+
27
34
  require 'ansel_iconv'
28
-
35
+
29
36
  # convert ANSEL to UTF-8
30
37
  converter = ANSEL::Iconv.new 'UTF-8'
31
38
  converter.iconv("\xB9\x004.59") # => "£4.59"
32
-
39
+
33
40
  You can use ANSEL::Iconv as a replacement for the built-in Iconv, because
34
41
  non-ANSEL conversions are simply passed through to Iconv.
35
42
 
36
43
  # convert UTF-8 to UTF-16
37
44
  converter = ANSEL::Iconv.new 'UTF-16', 'UTF-8'
38
45
  converter.iconv("£4.59") # => "\376\377\000\243\0004\000.\0005\0009"
39
-
46
+
40
47
  ## About the ANSEL character set
41
48
 
42
49
  [ANSI/NISO
@@ -49,7 +56,7 @@ standard.
49
56
 
50
57
  ## LICENSE:
51
58
 
52
- Copyright (c) 2006-2010 Keith Morrison <keithm@infused.org>
59
+ Copyright (c) 2006-2015 Keith Morrison <keithm@infused.org>
53
60
 
54
61
  Permission is hereby granted, free of charge, to any person obtaining
55
62
  a copy of this software and associated documentation files (the
@@ -0,0 +1,25 @@
1
+ # encoding: ascii-8bit
2
+
3
+ lib = File.expand_path('../lib/', __FILE__)
4
+ $:.unshift lib unless $:.include?(lib)
5
+ require 'ansel_iconv/version'
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = 'ansel_iconv'
9
+ s.version = ANSEL::Iconv::VERSION
10
+ s.authors = ["Keith Morrison"]
11
+ s.email = 'keithm@infused.org'
12
+ s.homepage = 'http://github.com/infused/ansel_iconv'
13
+ s.summary = 'Convert ANSEL encoded text'
14
+ s.description = 'Convert ANSEL encoded text to any other encoding available to Iconv'
15
+
16
+ s.rdoc_options = ['--charset=UTF-8']
17
+ s.extra_rdoc_files = ['README.md', 'CHANGELOG.md', 'LICENSE']
18
+ s.files = Dir['README.md', 'CHANGELOG.md', 'LICENSE', 'lib/**/*', 'ansel_iconv.gemspec']
19
+ s.require_paths = ['lib']
20
+
21
+ s.required_rubygems_version = '>= 1.3.6'
22
+ s.add_development_dependency 'rspec', '~> 2.10.0'
23
+ s.add_development_dependency 'rake', '~> 0.9.2'
24
+ end
25
+
@@ -3,11 +3,11 @@
3
3
  module ANSEL
4
4
  class Convert
5
5
  include ANSEL::CharacterMap
6
-
6
+
7
7
  def initialize(to_charset = 'UTF-8')
8
8
  @to_charset = to_charset
9
9
  end
10
-
10
+
11
11
  def ansi_to_utf8
12
12
  @ansi_to_utf8 ||= @@non_combining.merge(@@combining)
13
13
  end
@@ -18,32 +18,33 @@ module ANSEL
18
18
  until scanner.eos? do
19
19
  byte = scanner.get_byte
20
20
  char = byte.unpack('C')[0]
21
-
22
- if char <= 0x7F
21
+
22
+ case char
23
+ when 0x00..0x7F
23
24
  output << byte
24
- elsif char >= 0x88 && char <= 0xC8
25
+ when 0x88..0xC8
25
26
  hex_key = char.to_s(16).upcase
26
- output << ::Iconv.conv(@to_charset, 'UTF-16', ansi_to_utf8[hex_key] || ansi_to_utf8['ERR'])
27
+ output << ::Iconv.conv(@to_charset, 'UTF-16BE', ansi_to_utf8[hex_key] || ansi_to_utf8['ERR'])
27
28
  scanner.get_byte # ignore the next byte
28
- elsif char >= 0xE0 && char <= 0xFB
29
+ when 0xE0..0xFB
29
30
  [2, 1, 0].each do |n| # try 3 bytes, then 2 bytes, then 1 byte
30
31
  bytes = [char.to_s(16).upcase]
31
32
  scanner.peek(n).each_byte {|b| bytes << b.to_s(16).upcase}
32
33
  hex_key = bytes.join('+')
33
- if ansi_to_utf8.has_key?(hex_key)
34
- output << ::Iconv.conv(@to_charset, 'UTF-16', ansi_to_utf8[hex_key])
34
+ if ansi_to_utf8.has_key?(hex_key)
35
+ output << ::Iconv.conv(@to_charset, 'UTF-16BE', ansi_to_utf8[hex_key])
35
36
  n.times {scanner.get_byte}
36
37
  break
37
38
  end
38
39
  end
39
40
  else
40
- output << ::Iconv.conv(@to_charset, 'UTF-16', ansi_to_utf8['ERR'])
41
+ output << ::Iconv.conv(@to_charset, 'UTF-16BE', ansi_to_utf8['ERR'])
41
42
  scanner.get_byte if scanner.get_byte.unpack('C')[0] >= 0xE0 # ignore the next byte
42
43
  end
43
44
  end
44
-
45
+
45
46
  @to_charset == 'UTF-8' ? output : ::Iconv.conv(@to_charset, 'UTF-8', output)
46
47
  end
47
-
48
+
48
49
  end
49
- end
50
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ANSEL
4
4
  class Iconv
5
- VERSION = '1.1.6'
5
+ VERSION = '1.1.7'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,96 +1,82 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: ansel_iconv
3
- version: !ruby/object:Gem::Version
4
- hash: 31
5
- prerelease: false
6
- segments:
7
- - 1
8
- - 1
9
- - 6
10
- version: 1.1.6
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.7
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Keith Morrison
14
- autorequire:
8
+ autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2010-12-30 00:00:00 -08:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
11
+ date: 2023-05-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
22
14
  name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 2.10.0
20
+ type: :development
23
21
  prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ~>
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 2
32
- - 3
33
- - 0
34
- version: 2.3.0
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 2.10.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.9.2
35
34
  type: :development
36
- version_requirements: *id001
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.9.2
37
41
  description: Convert ANSEL encoded text to any other encoding available to Iconv
38
42
  email: keithm@infused.org
39
43
  executables: []
40
-
41
44
  extensions: []
42
-
43
- extra_rdoc_files:
45
+ extra_rdoc_files:
44
46
  - README.md
45
47
  - CHANGELOG.md
46
- - MIT-LICENSE
47
- files:
48
+ - LICENSE
49
+ files:
48
50
  - CHANGELOG.md
49
- - Gemfile
50
- - Gemfile.lock
51
- - MIT-LICENSE
52
- - Rakefile
51
+ - LICENSE
53
52
  - README.md
53
+ - ansel_iconv.gemspec
54
+ - lib/ansel_iconv.rb
54
55
  - lib/ansel_iconv/character_map.rb
55
56
  - lib/ansel_iconv/converter.rb
56
57
  - lib/ansel_iconv/iconv.rb
57
58
  - lib/ansel_iconv/version.rb
58
- - lib/ansel_iconv.rb
59
- has_rdoc: true
60
59
  homepage: http://github.com/infused/ansel_iconv
61
60
  licenses: []
62
-
63
- post_install_message:
64
- rdoc_options:
65
- - --charset=UTF-8
66
- require_paths:
61
+ metadata: {}
62
+ post_install_message:
63
+ rdoc_options:
64
+ - "--charset=UTF-8"
65
+ require_paths:
67
66
  - lib
68
- required_ruby_version: !ruby/object:Gem::Requirement
69
- none: false
70
- requirements:
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
71
69
  - - ">="
72
- - !ruby/object:Gem::Version
73
- hash: 3
74
- segments:
75
- - 0
76
- version: "0"
77
- required_rubygems_version: !ruby/object:Gem::Requirement
78
- none: false
79
- requirements:
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
80
74
  - - ">="
81
- - !ruby/object:Gem::Version
82
- hash: 27
83
- segments:
84
- - 1
85
- - 3
86
- - 0
87
- version: 1.3.0
75
+ - !ruby/object:Gem::Version
76
+ version: 1.3.6
88
77
  requirements: []
89
-
90
- rubyforge_project:
91
- rubygems_version: 1.3.7
92
- signing_key:
93
- specification_version: 3
78
+ rubygems_version: 3.4.13
79
+ signing_key:
80
+ specification_version: 4
94
81
  summary: Convert ANSEL encoded text
95
82
  test_files: []
96
-
data/Gemfile DELETED
@@ -1,2 +0,0 @@
1
- gemspec
2
- source :rubygems
data/Gemfile.lock DELETED
@@ -1,24 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- ansel_iconv (1.1.6)
5
-
6
- GEM
7
- remote: http://rubygems.org/
8
- specs:
9
- diff-lcs (1.1.2)
10
- rspec (2.3.0)
11
- rspec-core (~> 2.3.0)
12
- rspec-expectations (~> 2.3.0)
13
- rspec-mocks (~> 2.3.0)
14
- rspec-core (2.3.1)
15
- rspec-expectations (2.3.0)
16
- diff-lcs (~> 1.1.2)
17
- rspec-mocks (2.3.0)
18
-
19
- PLATFORMS
20
- ruby
21
-
22
- DEPENDENCIES
23
- ansel_iconv!
24
- rspec (~> 2.3.0)
data/Rakefile DELETED
@@ -1,15 +0,0 @@
1
- # encoding: ascii-8bit
2
-
3
- require 'rubygems'
4
-
5
- require 'rspec/core/rake_task'
6
- RSpec::Core::RakeTask.new :spec do |t|
7
- t.rspec_opts = %w(-fs --color)
8
- end
9
-
10
- task :default => :spec
11
-
12
- desc "Open an irb session preloaded with this library"
13
- task :console do
14
- sh "irb -rubygems -I lib -r dbf.rb"
15
- end