moc 2.5.0.2 → 2.5.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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(length).pack << self
30
+ Integer.new(bytesize).pack << encode('UTF-8').force_encoding('BINARY')
25
31
  end
26
32
  end
27
33
 
@@ -10,6 +10,6 @@
10
10
 
11
11
  module Moc
12
12
  def self.version
13
- '2.5.0.2'
13
+ '2.5.0.3'
14
14
  end
15
15
  end
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.2
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-21 00:00:00.000000000 Z
12
+ date: 2012-06-23 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description:
15
15
  email: meh@paranoici.org