glyr 0.9.9.1 → 0.9.9.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/glyr/results.rb +11 -1
- data/lib/glyr/version.rb +1 -1
- metadata +1 -1
data/lib/glyr/results.rb
CHANGED
@@ -125,7 +125,17 @@ class Result
|
|
125
125
|
|
126
126
|
module Text
|
127
127
|
def to_s
|
128
|
-
data
|
128
|
+
string = data
|
129
|
+
|
130
|
+
if string.force_encoding('UTF-8').valid_encoding?
|
131
|
+
string
|
132
|
+
elsif string.force_encoding('ISO-8859-1').valid_encoding?
|
133
|
+
string.encode!('UTF-8')
|
134
|
+
else
|
135
|
+
string.encode!('UTF-8', invalid: :replace, undef: :replace)
|
136
|
+
end
|
137
|
+
|
138
|
+
string
|
129
139
|
end
|
130
140
|
|
131
141
|
alias to_str to_s
|
data/lib/glyr/version.rb
CHANGED