moc 2.5.0.2 → 2.5.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/moc/protocol/string.rb +9 -3
- data/lib/moc/version.rb +1 -1
- metadata +2 -2
data/lib/moc/protocol/string.rb
CHANGED
@@ -16,12 +16,18 @@ class String < ::String
|
|
16
16
|
def self.read (io)
|
17
17
|
length = Integer.read(io)
|
18
18
|
string = io.read(length)
|
19
|
-
|
20
|
-
new(string)
|
19
|
+
|
20
|
+
new(if string.force_encoding('UTF-8').valid_encoding?
|
21
|
+
string
|
22
|
+
elsif string.force_encoding('ISO-8859-1').valid_encoding?
|
23
|
+
string.encode!('UTF-8')
|
24
|
+
else
|
25
|
+
string.encode!('UTF-8', invalid: :replace, undef: :replace)
|
26
|
+
end)
|
21
27
|
end
|
22
28
|
|
23
29
|
def pack
|
24
|
-
Integer.new(
|
30
|
+
Integer.new(bytesize).pack << encode('UTF-8').force_encoding('BINARY')
|
25
31
|
end
|
26
32
|
end
|
27
33
|
|
data/lib/moc/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.0.
|
4
|
+
version: 2.5.0.3
|
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-06-
|
12
|
+
date: 2012-06-23 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description:
|
15
15
|
email: meh@paranoici.org
|