payment_dta 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. data/LICENSE +20 -0
  2. data/README.rdoc +45 -0
  3. data/VERSION +1 -0
  4. data/generators/payment/USAGE +5 -0
  5. data/generators/payment/payment_generator.rb +76 -0
  6. data/generators/payment/templates/model.rb.erb +39 -0
  7. data/generators/payment/templates/spec.rb.erb +48 -0
  8. data/lib/payment_dta.rb +4 -0
  9. data/lib/payment_dta/character_conversion.rb +251 -0
  10. data/lib/payment_dta/dta_file.rb +55 -0
  11. data/lib/payment_dta/payment_sorting.rb +19 -0
  12. data/lib/payment_dta/payments/bank_cheque_payment.rb +60 -0
  13. data/lib/payment_dta/payments/base.rb +288 -0
  14. data/lib/payment_dta/payments/domestic_chf_payment.rb +67 -0
  15. data/lib/payment_dta/payments/esr_payment.rb +48 -0
  16. data/lib/payment_dta/payments/financial_institution_payment.rb +56 -0
  17. data/lib/payment_dta/payments/iban_payment.rb +76 -0
  18. data/lib/payment_dta/payments/special_financial_institution_payment.rb +64 -0
  19. data/lib/payment_dta/payments/total_record.rb +31 -0
  20. data/script/destroy +14 -0
  21. data/script/generate +14 -0
  22. data/spec/factory.rb +82 -0
  23. data/spec/lib/bank_cheque_payment_spec.rb +178 -0
  24. data/spec/lib/character_conversion_spec.rb +280 -0
  25. data/spec/lib/domestic_chf_payment_spec.rb +189 -0
  26. data/spec/lib/dta_file_spec.rb +81 -0
  27. data/spec/lib/esr_payment_spec.rb +157 -0
  28. data/spec/lib/financial_institution_payment_spec.rb +229 -0
  29. data/spec/lib/iban_payment_spec.rb +201 -0
  30. data/spec/lib/payment_header_spec.rb +221 -0
  31. data/spec/lib/payment_spec.rb +15 -0
  32. data/spec/lib/special_financial_institution_payment_spec.rb +238 -0
  33. data/spec/lib/total_record_spec.rb +20 -0
  34. data/spec/spec_helper.rb +9 -0
  35. metadata +107 -0
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Patrick Huesler
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,45 @@
1
+ = Swiss DTA payment file format
2
+
3
+ Ruby library for the Swiss DTA payment file format. See http://www.six-interbank-clearing.com/de/tkicch_index/tkicch_home/tkicch_standardization/tkicch_standardization_dta.htm?lang=1 for more Information.
4
+
5
+ The DTA documentation in PDF format can be found here: http://www.six-interbank-clearing.com/dl_tkicch_dta.pdf
6
+
7
+ == Status
8
+
9
+ Early alpha. All payments are supported. It lacks payment validations and extended documentation
10
+
11
+ == Installation
12
+
13
+ gem install payment_dta --source http://gemcutter.org
14
+
15
+ == Usage
16
+ require 'rubygems'
17
+ require 'payment_dta'
18
+
19
+ DTAFile.create("/tmp/dta_payment.dta") do |file|
20
+ file << ESRPayment.new(esr_attributes)
21
+ file << IBANPayment.new(iban_attributes)
22
+ end
23
+
24
+ == TODOS
25
+ * Add validations
26
+ * Merge namespaces DTA::Payment and DTA::Payments
27
+ * Remove duplications in payment classes
28
+ * Document the code according to the English DTA spec
29
+ * Add API to generate a string instead of a file so that it can be used in a web application
30
+ * Move tests for generator from test unit to rspec
31
+
32
+ == Note on Patches/Pull Requests
33
+
34
+ * Fork the project.
35
+ * Make your feature addition or bug fix.
36
+ * Add tests for it. This is important so I don't break it in a
37
+ future version unintentionally.
38
+ * Commit, do not mess with rakefile, version, or history.
39
+ (if you want to have your own version, that is fine but
40
+ bump version in a commit by itself I can ignore when I pull)
41
+ * Send me a pull request. Bonus points for topic branches.
42
+
43
+ == Copyright
44
+
45
+ Copyright (c) 2009 Patrick Huesler. See LICENSE for details.
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1,5 @@
1
+ Description:
2
+
3
+
4
+ Usage:
5
+
@@ -0,0 +1,76 @@
1
+ class PaymentGenerator < RubiGen::Base
2
+
3
+ default_options :author => nil
4
+
5
+ attr_reader :name, :class_name, :model_dir, :spec_dir, :file_base_name
6
+
7
+ def initialize(runtime_args, runtime_options = {})
8
+ super
9
+ usage if args.empty?
10
+ @name = args.shift
11
+ @class_name = "#{@name.camelize}Payment"
12
+ @file_base_name = "#{@name.underscore}_payment"
13
+ @model_dir = File.join('lib','payments')
14
+ @spec_dir = File.join('spec','lib')
15
+ @model_file = File.join(@model_dir,"#{@file_base_name}.rb")
16
+ @spec_file = File.join(spec_dir,"#{@file_base_name}_spec.rb")
17
+
18
+ extract_options
19
+ end
20
+
21
+ def manifest
22
+ record do |m|
23
+ # Ensure appropriate folder(s) exists
24
+ m.directory model_dir
25
+ m.directory spec_dir
26
+
27
+ # Create stubs
28
+ m.template "model.rb.erb", @model_file
29
+ m.template "spec.rb.erb", @spec_file
30
+
31
+ end
32
+ end
33
+
34
+ protected
35
+ def banner
36
+ <<-EOS
37
+ Creates a new DTA payment model
38
+
39
+ USAGE: #{$0} #{spec.name} name
40
+ EOS
41
+ end
42
+
43
+ def add_options!(opts)
44
+ # opts.separator ''
45
+ # opts.separator 'Options:'
46
+ # For each option below, place the default
47
+ # at the top of the file next to "default_options"
48
+ # opts.on("-a", "--author=\"Your Name\"", String,
49
+ # "Some comment about this option",
50
+ # "Default: none") { |o| options[:author] = o }
51
+ # opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
52
+ end
53
+
54
+ def extract_options
55
+ # for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
56
+ # Templates can access these value via the attr_reader-generated methods, but not the
57
+ # raw instance variable value.
58
+ # @author = options[:author]
59
+ end
60
+
61
+ def camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true)
62
+ if first_letter_in_uppercase
63
+ lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
64
+ else
65
+ lower_case_and_underscored_word.first.downcase + camelize(lower_case_and_underscored_word)[1..-1]
66
+ end
67
+ end
68
+
69
+ def underscore(camel_cased_word)
70
+ camel_cased_word.to_s.gsub(/::/, '/').
71
+ gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
72
+ gsub(/([a-z\d])([A-Z])/,'\1_\2').
73
+ tr("-", "_").
74
+ downcase
75
+ end
76
+ end
@@ -0,0 +1,39 @@
1
+ require 'payments/base'
2
+ require 'payment_sorting'
3
+
4
+ class <%= class_name %> < DTA::Payments::Base
5
+
6
+ def record
7
+ @record ||= segment1 + segment2 + segment3 + segment4 + segment5
8
+ end
9
+
10
+ def transaction_type
11
+ '832'
12
+ end
13
+
14
+ def payment_type
15
+ '0'
16
+ end
17
+
18
+ protected
19
+
20
+ def build_segment1
21
+ super
22
+ end
23
+
24
+ def build_segment2
25
+ super
26
+ end
27
+
28
+ def build_segment3
29
+ super
30
+ end
31
+
32
+ def build_segment4
33
+ super
34
+ end
35
+
36
+ def build_segment5
37
+ super
38
+ end
39
+ end
@@ -0,0 +1,48 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+ require '<%= File.join('payments',file_base_name) %>'
3
+ <% factory = "Factory.create_#{file_base_name}" %>
4
+ describe <%= class_name %> do
5
+ it "should have a total length of 640 characters" do
6
+ <%= factory %>.record.size.should == 640
7
+ end
8
+
9
+ <%- 1.upto(6) do |index| -%>
10
+ <%- payment = "#{factory}.segment#{index}" -%>
11
+ describe 'segment<%= index %>' do
12
+ it 'should set the segment field to 0<%= index %>' do
13
+ <%= payment %>[0,2].should == '0<%= index %>'
14
+ end
15
+
16
+ it 'should have a reserve field' do
17
+ <%= payment %>[114,11].should == ' '.ljust(11)
18
+ end
19
+
20
+ it 'should have a total length of 128 characters' do
21
+ <%= payment %>.size.should == 128
22
+ end
23
+ end
24
+ <%- end -%>
25
+
26
+ describe 'comparison' do
27
+ it "should sort by execution date ascending" do
28
+ @record1 = <%= factory %>(:requested_processing_date => "091026")
29
+ @record2 = <%= factory %>(:requested_processing_date => "091027")
30
+
31
+ (@record1 < @record2).should be_true
32
+ end
33
+
34
+ it "should sort by issuer identification" do
35
+ @record1 = <%= factory %>(:issuer_identification => "AAAAA")
36
+ @record2 = <%= factory %>(:issuer_identification => "BBBBB")
37
+
38
+ (@record1 < @record2).should be_true
39
+ end
40
+
41
+ it "should sort by issuers clearing number when issuer identifications are equal" do
42
+ @record1 = <%= factory %>(:issuer_identification => "AAAAA", :ordering_party_bank_clearing_number => '253')
43
+ @record2 = <%= factory %>(:issuer_identification => "AAAAA", :ordering_party_bank_clearing_number => '254')
44
+
45
+ (@record1 < @record2).should be_true
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,4 @@
1
+ require 'payment_dta/dta_file'
2
+ %w(esr_payment domestic_chf_payment financial_institution_payment bank_cheque_payment iban_payment special_financial_institution_payment total_record).each do |payment_type|
3
+ require "payment_dta/payments/#{payment_type}"
4
+ end
@@ -0,0 +1,251 @@
1
+ require 'iconv'
2
+ module DTA
3
+ module CharacterConversion
4
+ CONVERSION_MAP_UTF8 = {
5
+ 32 => {:name => "SPACE", :convert_to => " "},
6
+ 33 => {:name => "EXCLAMATION MARK", :convert_to => "."},
7
+ 34 => {:name => "QUOTATION MARK", :convert_to => "."},
8
+ 35 => {:name => "NUMBER SIGN", :convert_to => "."},
9
+ 36 => {:name => "DOLLAR SIGN", :convert_to => "."},
10
+ 37 => {:name => "PERCENT SIGN", :convert_to => "."},
11
+ 38 => {:name => "AMPERSAND", :convert_to => "+"},
12
+ 39 => {:name => "APOSTROPHE", :convert_to => "'"},
13
+ 40 => {:name => "LEFT PARENTHESIS", :convert_to => "("},
14
+ 41 => {:name => "RIGHT PARENTHESIS", :convert_to => ")"},
15
+ 42 => {:name => "ASTERISK", :convert_to => "."},
16
+ 43 => {:name => "PLUS SIGN", :convert_to => "+"},
17
+ 44 => {:name => "COMMA", :convert_to => ","},
18
+ 45 => {:name => "HYPHEN-MINUS", :convert_to => "-"},
19
+ 46 => {:name => "FULL STOP", :convert_to => "."},
20
+ 47 => {:name => "SOLIDUS", :convert_to => "/"},
21
+ 48 => {:name => "DIGIT ZERO", :convert_to => "0"},
22
+ 49 => {:name => "DIGIT ONE", :convert_to => "1"},
23
+ 50 => {:name => "DIGIT TWO", :convert_to => "2"},
24
+ 51 => {:name => "DIGIT THREE", :convert_to => "3"},
25
+ 52 => {:name => "DIGIT FOUR", :convert_to => "4"},
26
+ 53 => {:name => "DIGIT FIVE", :convert_to => "5"},
27
+ 54 => {:name => "DIGIT SIX", :convert_to => "6"},
28
+ 55 => {:name => "DIGIT SEVEN", :convert_to => "7"},
29
+ 56 => {:name => "DIGIT EIGHT", :convert_to => "8"},
30
+ 57 => {:name => "DIGIT NINE", :convert_to => "9"},
31
+ 58 => {:name => "COLON", :convert_to => ":"},
32
+ 59 => {:name => "SEMICOLON", :convert_to => "."},
33
+ 60 => {:name => "LESS-THAN SIGN", :convert_to => "."},
34
+ 61 => {:name => "EQUALS SIGN", :convert_to => "."},
35
+ 62 => {:name => "GREATER-THAN SIGN", :convert_to => "."},
36
+ 63 => {:name => "QUESTION MARK", :convert_to => "?"},
37
+ 64 => {:name => "COMMERCIAL AT", :convert_to => "."},
38
+ 65 => {:name => "LATIN CAPITAL LETTER A", :convert_to => "A"},
39
+ 66 => {:name => "LATIN CAPITAL LETTER B", :convert_to => "B"},
40
+ 67 => {:name => "LATIN CAPITAL LETTER C", :convert_to => "C"},
41
+ 68 => {:name => "LATIN CAPITAL LETTER D", :convert_to => "D"},
42
+ 69 => {:name => "LATIN CAPITAL LETTER E", :convert_to => "E"},
43
+ 70 => {:name => "LATIN CAPITAL LETTER F", :convert_to => "F"},
44
+ 71 => {:name => "LATIN CAPITAL LETTER G", :convert_to => "G"},
45
+ 72 => {:name => "LATIN CAPITAL LETTER H", :convert_to => "H"},
46
+ 73 => {:name => "LATIN CAPITAL LETTER I", :convert_to => "I"},
47
+ 74 => {:name => "LATIN CAPITAL LETTER J", :convert_to => "J"},
48
+ 75 => {:name => "LATIN CAPITAL LETTER K", :convert_to => "K"},
49
+ 76 => {:name => "LATIN CAPITAL LETTER L", :convert_to => "L"},
50
+ 77 => {:name => "LATIN CAPITAL LETTER M", :convert_to => "M"},
51
+ 78 => {:name => "LATIN CAPITAL LETTER N", :convert_to => "N"},
52
+ 79 => {:name => "LATIN CAPITAL LETTER O", :convert_to => "O"},
53
+ 80 => {:name => "LATIN CAPITAL LETTER P", :convert_to => "P"},
54
+ 81 => {:name => "LATIN CAPITAL LETTER Q", :convert_to => "Q"},
55
+ 82 => {:name => "LATIN CAPITAL LETTER R", :convert_to => "R"},
56
+ 83 => {:name => "LATIN CAPITAL LETTER S", :convert_to => "S"},
57
+ 84 => {:name => "LATIN CAPITAL LETTER T", :convert_to => "T"},
58
+ 85 => {:name => "LATIN CAPITAL LETTER U", :convert_to => "U"},
59
+ 86 => {:name => "LATIN CAPITAL LETTER V", :convert_to => "V"},
60
+ 87 => {:name => "LATIN CAPITAL LETTER W", :convert_to => "W"},
61
+ 88 => {:name => "LATIN CAPITAL LETTER X", :convert_to => "X"},
62
+ 89 => {:name => "LATIN CAPITAL LETTER Y", :convert_to => "Y"},
63
+ 90 => {:name => "LATIN CAPITAL LETTER Z", :convert_to => "Z"},
64
+ 91 => {:name => "LEFT SQUARE BRACKET", :convert_to => "."},
65
+ 92 => {:name => "REVERSE SOLIDUS", :convert_to => "."},
66
+ 93 => {:name => "RIGHT SQUARE BRACKET", :convert_to => "."},
67
+ 94 => {:name => "CIRCUMFLEX ACCENT", :convert_to => "."},
68
+ 95 => {:name => "LOW LINE", :convert_to => "."},
69
+ 96 => {:name => "GRAVE ACCENT", :convert_to => "."},
70
+ 97 => {:name => "LATIN SMALL LETTER A", :convert_to => "a"},
71
+ 98 => {:name => "LATIN SMALL LETTER B", :convert_to => "b"},
72
+ 99 => {:name => "LATIN SMALL LETTER C", :convert_to => "c"},
73
+ 100 => {:name => "LATIN SMALL LETTER D", :convert_to => "d"},
74
+ 101 => {:name => "LATIN SMALL LETTER E", :convert_to => "e"},
75
+ 102 => {:name => "LATIN SMALL LETTER F", :convert_to => "f"},
76
+ 103 => {:name => "LATIN SMALL LETTER G", :convert_to => "g"},
77
+ 104 => {:name => "LATIN SMALL LETTER H", :convert_to => "h"},
78
+ 105 => {:name => "LATIN SMALL LETTER I", :convert_to => "i"},
79
+ 106 => {:name => "LATIN SMALL LETTER J", :convert_to => "j"},
80
+ 107 => {:name => "LATIN SMALL LETTER K", :convert_to => "k"},
81
+ 108 => {:name => "LATIN SMALL LETTER L", :convert_to => "l"},
82
+ 109 => {:name => "LATIN SMALL LETTER M", :convert_to => "m"},
83
+ 110 => {:name => "LATIN SMALL LETTER N", :convert_to => "n"},
84
+ 111 => {:name => "LATIN SMALL LETTER O", :convert_to => "o"},
85
+ 112 => {:name => "LATIN SMALL LETTER P", :convert_to => "p"},
86
+ 113 => {:name => "LATIN SMALL LETTER Q", :convert_to => "q"},
87
+ 114 => {:name => "LATIN SMALL LETTER R", :convert_to => "r"},
88
+ 115 => {:name => "LATIN SMALL LETTER S", :convert_to => "s"},
89
+ 116 => {:name => "LATIN SMALL LETTER T", :convert_to => "t"},
90
+ 117 => {:name => "LATIN SMALL LETTER U", :convert_to => "u"},
91
+ 118 => {:name => "LATIN SMALL LETTER V", :convert_to => "v"},
92
+ 119 => {:name => "LATIN SMALL LETTER W", :convert_to => "w"},
93
+ 120 => {:name => "LATIN SMALL LETTER X", :convert_to => "x"},
94
+ 121 => {:name => "LATIN SMALL LETTER Y", :convert_to => "y"},
95
+ 122 => {:name => "LATIN SMALL LETTER Z", :convert_to => "z"},
96
+ 123 => {:name => "LEFT CURLY BRACKET", :convert_to => "."},
97
+ 124 => {:name => "VERTICAL LINE", :convert_to => "."},
98
+ 125 => {:name => "RIGHT CURLY BRACKET", :convert_to => "."},
99
+ 126 => {:name => "TILDE", :convert_to => "."},
100
+ 127 => {:name => "CONTROL", :convert_to => ' '},
101
+ 194128 => {:name => "CONTROL", :convert_to => ' '},
102
+ 194129 => {:name => "CONTROL", :convert_to => ' '},
103
+ 194130 => {:name => "CONTROL", :convert_to => ' '},
104
+ 194131 => {:name => "CONTROL", :convert_to => ' '},
105
+ 194132 => {:name => "CONTROL", :convert_to => ' '},
106
+ 194133 => {:name => "CONTROL", :convert_to => ' '},
107
+ 194134 => {:name => "CONTROL", :convert_to => ' '},
108
+ 194135 => {:name => "CONTROL", :convert_to => ' '},
109
+ 194136 => {:name => "CONTROL", :convert_to => ' '},
110
+ 194137 => {:name => "CONTROL", :convert_to => ' '},
111
+ 194138 => {:name => "CONTROL", :convert_to => ' '},
112
+ 194139 => {:name => "CONTROL", :convert_to => ' '},
113
+ 194140 => {:name => "CONTROL", :convert_to => ' '},
114
+ 194141 => {:name => "CONTROL", :convert_to => ' '},
115
+ 194142 => {:name => "CONTROL", :convert_to => ' '},
116
+ 194143 => {:name => "CONTROL", :convert_to => ' '},
117
+ 194144 => {:name => "CONTROL", :convert_to => ' '},
118
+ 194145 => {:name => "CONTROL", :convert_to => ' '},
119
+ 194146 => {:name => "CONTROL", :convert_to => ' '},
120
+ 194147 => {:name => "CONTROL", :convert_to => ' '},
121
+ 194148 => {:name => "CONTROL", :convert_to => ' '},
122
+ 194149 => {:name => "CONTROL", :convert_to => ' '},
123
+ 194150 => {:name => "CONTROL", :convert_to => ' '},
124
+ 194151 => {:name => "CONTROL", :convert_to => ' '},
125
+ 194152 => {:name => "CONTROL", :convert_to => ' '},
126
+ 194153 => {:name => "CONTROL", :convert_to => ' '},
127
+ 194154 => {:name => "CONTROL", :convert_to => ' '},
128
+ 194155 => {:name => "CONTROL", :convert_to => ' '},
129
+ 194156 => {:name => "CONTROL", :convert_to => ' '},
130
+ 194157 => {:name => "CONTROL", :convert_to => ' '},
131
+ 194158 => {:name => "CONTROL", :convert_to => ' '},
132
+ 194159 => {:name => "CONTROL", :convert_to => ' '},
133
+ 194160 => {:name => "NO-BREAK SPACE", :convert_to => '.'},
134
+ 194161 => {:name => "INVERTED EXCLAMATION MARK", :convert_to => '.'},
135
+ 194162 => {:name => "CENT SIGN", :convert_to => '.'},
136
+ 194163 => {:name => "POUND SIGN", :convert_to => '.'},
137
+ 194164 => {:name => "CURRENCY SIGN", :convert_to => '.'},
138
+ 194165 => {:name => "YEN SIGN", :convert_to => '.'},
139
+ 194166 => {:name => "BROKEN BAR", :convert_to => '.'},
140
+ 194167 => {:name => "SECTION SIGN", :convert_to => '.'},
141
+ 194168 => {:name => "DIAERESIS", :convert_to => '.'},
142
+ 194169 => {:name => "COPYRIGHT SIGN", :convert_to => '.'},
143
+ 194170 => {:name => "FEMININE ORDINAL INDICATOR", :convert_to => '.'},
144
+ 194171 => {:name => "LEFT-POINTING DOUBLE ANGLE QUOTATION MARK", :convert_to => '.'},
145
+ 194172 => {:name => "NOT SIGN", :convert_to => '.'},
146
+ 194173 => {:name => "SOFT HYPHEN", :convert_to => '.'},
147
+ 194174 => {:name => "REGISTERED SIGN", :convert_to => '.'},
148
+ 194175 => {:name => "MACRON", :convert_to => '.'},
149
+ 194176 => {:name => "DEGREE SIGN", :convert_to => '.'},
150
+ 194177 => {:name => "PLUS-MINUS SIGN", :convert_to => '.'},
151
+ 194178 => {:name => "SUPERSCRIPT TWO", :convert_to => '.'},
152
+ 194179 => {:name => "SUPERSCRIPT THREE", :convert_to => '.'},
153
+ 194180 => {:name => "ACUTE ACCENT", :convert_to => '.'},
154
+ 194181 => {:name => "MICRO SIGN", :convert_to => '.'},
155
+ 194182 => {:name => "PILCROW SIGN", :convert_to => '.'},
156
+ 194183 => {:name => "MIDDLE DOT", :convert_to => '.'},
157
+ 194184 => {:name => "CEDILLA", :convert_to => '.'},
158
+ 194185 => {:name => "SUPERSCRIPT ONE", :convert_to => '.'},
159
+ 194186 => {:name => "MASCULINE ORDINAL INDICATOR", :convert_to => '.'},
160
+ 194187 => {:name => "RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK", :convert_to => '.'},
161
+ 194188 => {:name => "VULGAR FRACTION ONE QUARTER", :convert_to => '.'},
162
+ 194189 => {:name => "VULGAR FRACTION ONE HALF", :convert_to => '.'},
163
+ 194190 => {:name => "VULGAR FRACTION THREE QUARTERS", :convert_to => '.'},
164
+ 194191 => {:name => "INVERTED QUESTION MARK", :convert_to => '.'},
165
+ 195128 => {:name => "LATIN CAPITAL LETTER A WITH GRAVE", :convert_to => 'A'},
166
+ 195129 => {:name => "LATIN CAPITAL LETTER A WITH ACUTE", :convert_to => 'A'},
167
+ 195130 => {:name => "LATIN CAPITAL LETTER A WITH CIRCUMFLEX", :convert_to => 'A'},
168
+ 195131 => {:name => "LATIN CAPITAL LETTER A WITH TILDE", :convert_to => 'A'},
169
+ 195132 => {:name => "LATIN CAPITAL LETTER A WITH DIAERESIS", :convert_to => 'AE'},
170
+ 195133 => {:name => "LATIN CAPITAL LETTER A WITH RING ABOVE", :convert_to => 'A'},
171
+ 195134 => {:name => "LATIN CAPITAL LETTER AE", :convert_to => 'AE'},
172
+ 195135 => {:name => "LATIN CAPITAL LETTER C WITH CEDILLA", :convert_to => 'C'},
173
+ 195136 => {:name => "LATIN CAPITAL LETTER E WITH GRAVE", :convert_to => 'E'},
174
+ 195137 => {:name => "LATIN CAPITAL LETTER E WITH ACUTE", :convert_to => 'E'},
175
+ 195138 => {:name => "LATIN CAPITAL LETTER E WITH CIRCUMFLEX", :convert_to => 'E'},
176
+ 195139 => {:name => "LATIN CAPITAL LETTER E WITH DIAERES", :convert_to => 'E'},
177
+ 195140 => {:name => "LATIN CAPITAL LETTER I WITH GRAVE", :convert_to => 'I'},
178
+ 195141 => {:name => "LATIN CAPITAL LETTER I WITH ACUTE", :convert_to => 'I'},
179
+ 195142 => {:name => "LATIN CAPITAL LETTER I WITH CIRCUMFLEX", :convert_to => 'I'},
180
+ 195143 => {:name => "LATIN CAPITAL LETTER I WITH DIAERESIS", :convert_to => 'I'},
181
+ 195144 => {:name => "LATIN CAPITAL LETTER ETH", :convert_to => '.'},
182
+ 195145 => {:name => "LATIN CAPITAL LETTER N WITH TILDE", :convert_to => 'N'},
183
+ 195146 => {:name => "LATIN CAPITAL LETTER O WITH GRAVE", :convert_to => 'O'},
184
+ 195147 => {:name => "LATIN CAPITAL LETTER O WITH ACUTE", :convert_to => 'O'},
185
+ 195148 => {:name => "LATIN CAPITAL LETTER O WITH CIRCUMFLEX", :convert_to => 'O'},
186
+ 195149 => {:name => "LATIN CAPITAL LETTER O WITH TILDE", :convert_to => 'O'},
187
+ 195150 => {:name => "LATIN CAPITAL LETTER O WITH DIAERESIS", :convert_to => 'OE'},
188
+ 195151 => {:name => "MULTIPLICATION SIGN", :convert_to => '.'},
189
+ 195152 => {:name => "LATIN CAPITAL LETTER O WITH STROKE", :convert_to => '.'},
190
+ 195153 => {:name => "LATIN CAPITAL LETTER U WITH GRAVE", :convert_to => 'U'},
191
+ 195154 => {:name => "LATIN CAPITAL LETTER U WITH ACUTE", :convert_to => 'U'},
192
+ 195155 => {:name => "LATIN CAPITAL LETTER U WITH CIRCUMFLEX", :convert_to => 'U'},
193
+ 195156 => {:name => "LATIN CAPITAL LETTER U WITH DIAERESIS", :convert_to => 'UE'},
194
+ 195157 => {:name => "LATIN CAPITAL LETTER Y WITH ACUTE", :convert_to => 'Y'},
195
+ 195158 => {:name => "LATIN CAPITAL LETTER THORN", :convert_to => '.'},
196
+ 195159 => {:name => "LATIN SMALL LETTER SHARP S", :convert_to => 'ss'},
197
+ 195160 => {:name => "LATIN SMALL LETTER A WITH GRAVE", :convert_to => 'a'},
198
+ 195161 => {:name => "LATIN SMALL LETTER A WITH ACUTE", :convert_to => 'a'},
199
+ 195162 => {:name => "LATIN SMALL LETTER A WITH CIRCUMFLEX", :convert_to => 'a'},
200
+ 195163 => {:name => "LATIN SMALL LETTER A WITH TILDE", :convert_to => 'a'},
201
+ 195164 => {:name => "LATIN SMALL LETTER A WITH DIAERESIS", :convert_to => 'ae'},
202
+ 195165 => {:name => "LATIN SMALL LETTER A WITH RING ABOVE", :convert_to => 'a'},
203
+ 195166 => {:name => "LATIN SMALL LETTER AE", :convert_to => 'ae'},
204
+ 195167 => {:name => "LATIN SMALL LETTER C WITH CEDILLA", :convert_to => 'c'},
205
+ 195168 => {:name => "LATIN SMALL LETTER E WITH GRAVE", :convert_to => 'e'},
206
+ 195169 => {:name => "LATIN SMALL LETTER E WITH ACUTE", :convert_to => 'e'},
207
+ 195170 => {:name => "LATIN SMALL LETTER E WITH CIRCUMFLEX", :convert_to => 'e'},
208
+ 195171 => {:name => "LATIN SMALL LETTER E WITH DIAERESIS", :convert_to => 'e'},
209
+ 195172 => {:name => "LATIN SMALL LETTER I WITH GRAVE", :convert_to => 'i'},
210
+ 195173 => {:name => "LATIN SMALL LETTER I WITH ACUTE", :convert_to => 'i'},
211
+ 195174 => {:name => "LATIN SMALL LETTER I WITH CIRCUMFLEX", :convert_to => 'i'},
212
+ 195175 => {:name => "LATIN SMALL LETTER I WITH DIAERESIS", :convert_to => 'i'},
213
+ 195176 => {:name => "LATIN SMALL LETTER ETH", :convert_to => '.'},
214
+ 195177 => {:name => "LATIN SMALL LETTER N WITH TILE", :convert_to => 'n'},
215
+ 195178 => {:name => "LATIN SMALL LETTER O WITH GRAVE", :convert_to => 'o'},
216
+ 195179 => {:name => "LATIN SMALL LETTER O WITH ACUTE", :convert_to => 'o'},
217
+ 195180 => {:name => "LATIN SMALL LETTER O WITH CIRCUMFLEX", :convert_to => 'o'},
218
+ 195181 => {:name => "LATIN SMALL LETTER O WITH TILDE", :convert_to => 'o'},
219
+ 195182 => {:name => "LATIN SMALL LETTER O WITH DIAERESIS", :convert_to => 'oe'},
220
+ 195183 => {:name => "DIVISION SIGN", :convert_to => '.'},
221
+ 195184 => {:name => "LATIN SMALL LETTER O WITH STROKE", :convert_to => '.'},
222
+ 195185 => {:name => "LATIN SMALL LETTER U WITH GRAVE", :convert_to => 'u'},
223
+ 195186 => {:name => "LATIN SMALL LETTER U WITH ACUTE", :convert_to => 'u'},
224
+ 195187 => {:name => "LATIN SMALL LETTER U WITH CIRCUMFLEX", :convert_to => 'u'},
225
+ 195188 => {:name => "LATIN SMALL LETTER U WITH DIAERESIS", :convert_to => 'ue'},
226
+ 195189 => {:name => "LATIN SMALL LETTER Y WITH ACUTE", :convert_to => 'y'},
227
+ 195190 => {:name => "LATIN SMALL LETTER THORN", :convert_to => '.'},
228
+ 195191 => {:name => "LATIN SMALL LETTER Y WITH DIAERESIS", :convert_to => 'y'},
229
+ } unless defined?(CONVERSION_MAP_UTF8)
230
+ def map_characters(string)
231
+ new_string = ""
232
+ string.each_char do |character|
233
+ code = character.size == 1 ? character[0] : "#{character[0]}#{character[1]}".to_i
234
+ if CONVERSION_MAP_UTF8.has_key?(code)
235
+ new_string << CONVERSION_MAP_UTF8[code][:convert_to]
236
+ else
237
+ new_string << ' '
238
+ end
239
+ end
240
+ new_string
241
+ end
242
+
243
+ def encode_characters(string)
244
+ Iconv.conv("ISO-8859-1", "UTF8",string)
245
+ end
246
+
247
+ def dta_string(string)
248
+ encode_characters(map_characters(string))
249
+ end
250
+ end
251
+ end