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.
Files changed (3) hide show
  1. data/lib/glyr/results.rb +11 -1
  2. data/lib/glyr/version.rb +1 -1
  3. 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
@@ -12,6 +12,6 @@ require 'glyr'
12
12
 
13
13
  module Glyr
14
14
  def self.version
15
- '0.9.9.1'
15
+ '0.9.9.2'
16
16
  end
17
17
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glyr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.9.1
4
+ version: 0.9.9.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: