printr 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/printr.rb +7 -2
- data/printr.gemspec +1 -1
- metadata +3 -3
data/lib/printr.rb
CHANGED
@@ -155,7 +155,12 @@ module Printr
|
|
155
155
|
# 3 the replacement etc. [needle,replace,needle,replace,needle,replace]
|
156
156
|
Printr.log "sanitize(#{text[0..55]})"
|
157
157
|
Printr.log "Forcing encoding to: " + Printr.encoding # Printr.encoding can be set in initializer with config.encoding = ISO-8859-15 etc
|
158
|
-
|
158
|
+
begin
|
159
|
+
text.encode! Printr.encoding;
|
160
|
+
rescue
|
161
|
+
Printr.log "Failed to encode with #{Printr.encoding}, trying UTF-8"
|
162
|
+
begin text.encode! "UTF-8"; rescue; end
|
163
|
+
end
|
159
164
|
char = ['ä', 'ü', 'ö', 'Ä', 'Ü', 'Ö', 'é', 'è', 'ú', 'ù', 'á', 'à', 'í', 'ì', 'ó', 'ò', 'â', 'ê', 'î', 'ô', 'û', 'ñ', 'ß']
|
160
165
|
replacement = ["\x84", "\x81", "\x94", "\x8E", "\x9A", "\x99", "\x82", "\x8A", "\xA3", "\x97", "\xA0", "\x85", "\xA1", "\x8D", "\xA2", "\x95", "\x83", "\x88", "\x8C", "\x93", "\x96", "\xA4", "\xE1"]
|
161
166
|
i = 0
|
@@ -172,7 +177,7 @@ module Printr
|
|
172
177
|
rx = Printr.sanitize_tokens[i]
|
173
178
|
rep = Printr.sanitize_tokens[i+1]
|
174
179
|
Printr.log "Replacing: " + rx.to_s + " with " + rep.to_s
|
175
|
-
text.gsub!(rx, rep)
|
180
|
+
begin text.gsub!(rx, rep); rescue; end
|
176
181
|
i += 2
|
177
182
|
end while i < Printr.sanitize_tokens.length
|
178
183
|
return text
|
data/printr.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: printr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-01-
|
13
|
+
date: 2012-01-26 00:00:00.000000000Z
|
14
14
|
dependencies: []
|
15
15
|
description: This engine allows you to define printers and templates.
|
16
16
|
email:
|
@@ -60,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
60
60
|
version: '0'
|
61
61
|
requirements: []
|
62
62
|
rubyforge_project: printr
|
63
|
-
rubygems_version: 1.8.
|
63
|
+
rubygems_version: 1.8.15
|
64
64
|
signing_key:
|
65
65
|
specification_version: 3
|
66
66
|
summary: An engine for interfacing with printers.
|