protobuf 2.7.8-java → 2.7.9-java
Sign up to get free protection for your applications and to get access to all the features.
@@ -12,7 +12,7 @@ module Protobuf
|
|
12
12
|
|
13
13
|
def encode(value)
|
14
14
|
# TODO: make replace character configurable?
|
15
|
-
value.encode!(::Protobuf::Field::StringField::ENCODING,
|
15
|
+
value.encode!(::Protobuf::Field::StringField::ENCODING, :invalid => :replace, :undef => :replace, :replace => "")
|
16
16
|
value.force_encoding(::Protobuf::Field::BytesField::BYTES_ENCODING)
|
17
17
|
|
18
18
|
string_size = ::Protobuf::Field::VarintField.encode(value.size)
|
data/lib/protobuf/version.rb
CHANGED
@@ -44,11 +44,24 @@ describe Protobuf::Message do
|
|
44
44
|
expect { message.serialize_to_string }.to_not raise_error
|
45
45
|
end
|
46
46
|
|
47
|
-
it "
|
48
|
-
|
47
|
+
it "keeps utf-8 when utf-8 is input for string fields" do
|
48
|
+
name = "my name\xC3"
|
49
|
+
name.force_encoding("UTF-8")
|
50
|
+
|
51
|
+
message = ::Test::Resource.new(:name => name)
|
52
|
+
new_message = ::Test::Resource.new
|
53
|
+
new_message.parse_from_string(message.serialize_to_string)
|
54
|
+
(new_message.name == name).should be_true
|
55
|
+
end
|
56
|
+
|
57
|
+
it "trims binary when binary is input for string fields" do
|
58
|
+
name = "my name\xC3"
|
59
|
+
name.force_encoding("ASCII-8BIT")
|
60
|
+
|
61
|
+
message = ::Test::Resource.new(:name => name)
|
49
62
|
new_message = ::Test::Resource.new
|
50
63
|
new_message.parse_from_string(message.serialize_to_string)
|
51
|
-
new_message.name
|
64
|
+
(new_message.name == "my name").should be_true
|
52
65
|
end
|
53
66
|
end
|
54
67
|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: protobuf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 2.7.
|
5
|
+
version: 2.7.9
|
6
6
|
platform: java
|
7
7
|
authors:
|
8
8
|
- BJ Neilsen
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-04-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|