gamespy_query 0.2.0pre13 → 0.2.0pre14
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/gamespy_query/base.rb +3 -3
- data/lib/gamespy_query/version.rb +1 -1
- metadata +1 -1
data/lib/gamespy_query/base.rb
CHANGED
@@ -101,7 +101,7 @@ STR
|
|
101
101
|
number
|
102
102
|
end
|
103
103
|
|
104
|
-
STR_UTF8 = 'UTF-8'
|
104
|
+
STR_UTF8, STR_UTF16 = 'UTF-8', 'UTF-16'
|
105
105
|
|
106
106
|
# Convert string to UTF-8, stripping out all invalid/undefined characters
|
107
107
|
# @param [String] str String to convert
|
@@ -111,11 +111,11 @@ STR
|
|
111
111
|
#else
|
112
112
|
# str.encode(STR_UTF8, STR_UTF8, invalid: :replace, undef: :replace)
|
113
113
|
#end
|
114
|
-
alt ? str.encode(STR_UTF8, invalid: :replace, undef: :replace) :
|
114
|
+
alt ? str.encode(STR_UTF8, invalid: :replace, undef: :replace).encode(STR_UTF16, STR_UTF8, invalid: :replace, undef: :replace).encode(STR_UTF8, STR_UTF16) : str.encode(STR_UTF16, STR_UTF8, invalid: :replace, undef: :replace).encode(STR_UTF8, STR_UTF16)
|
115
115
|
rescue nil, Exception => e
|
116
116
|
# Fallback - convert to UTF and replace any invalid or undefined
|
117
117
|
Tools.log_exception e
|
118
|
-
str.encode(STR_UTF8, invalid: :replace, undef: :replace)
|
118
|
+
str.encode(STR_UTF8, invalid: :replace, undef: :replace).encode(STR_UTF16, STR_UTF8, invalid: :replace, undef: :replace).encode(STR_UTF8, STR_UTF16)
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|