gamespy_query 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/gamespy_query/parser.rb +6 -2
- data/lib/gamespy_query/version.rb +1 -1
- metadata +3 -3
data/lib/gamespy_query/parser.rb
CHANGED
@@ -98,6 +98,10 @@ module GamespyQuery
|
|
98
98
|
# Encoding
|
99
99
|
get_string(packet)
|
100
100
|
end
|
101
|
+
|
102
|
+
def clean(str)
|
103
|
+
str.encode("UTF-8", invalid: :replace, undef: :replace)
|
104
|
+
end
|
101
105
|
|
102
106
|
def parse_game_data(packet)
|
103
107
|
Tools.debug {"Game Parsing #{packet.inspect}"}
|
@@ -109,7 +113,7 @@ module GamespyQuery
|
|
109
113
|
if (index % 2) == 0
|
110
114
|
key = data
|
111
115
|
else
|
112
|
-
game_data[key] = data
|
116
|
+
game_data[key] = data.is_a?(String) ? clean(data) : data
|
113
117
|
end
|
114
118
|
end
|
115
119
|
|
@@ -167,7 +171,7 @@ module GamespyQuery
|
|
167
171
|
# Parse the data - \x00 is printed after a non-nil entry, otherwise \x00 means nil (e.g empty team)
|
168
172
|
until str.empty?
|
169
173
|
entry = str[RX_X0_SPEC]
|
170
|
-
player_data[player_data.keys[i]] << entry.sub(STR_X0, STR_EMPTY)
|
174
|
+
player_data[player_data.keys[i]] << clean(entry.sub(STR_X0, STR_EMPTY))
|
171
175
|
str.sub!(entry, STR_EMPTY)
|
172
176
|
end
|
173
177
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gamespy_query
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-02-10 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: ''
|
15
15
|
email:
|
@@ -49,7 +49,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
49
49
|
version: '0'
|
50
50
|
requirements: []
|
51
51
|
rubyforge_project: gamespy_query
|
52
|
-
rubygems_version: 1.8.
|
52
|
+
rubygems_version: 1.8.15
|
53
53
|
signing_key:
|
54
54
|
specification_version: 3
|
55
55
|
summary: Ruby library for accessing Gamespy services
|