protobuf 2.7.8-java → 2.7.9-java

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.
@@ -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, ::Protobuf::Field::BytesField::BYTES_ENCODING, :invalid => :replace, :undef => :replace, :replace => "")
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)
@@ -1,4 +1,4 @@
1
1
  module Protobuf
2
- VERSION = '2.7.8'
2
+ VERSION = '2.7.9'
3
3
  PROTOC_VERSION = '2.4.1'
4
4
  end
@@ -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 "trims unicode characters from string fields" do
48
- message = ::Test::Resource.new(:name => "my name\xc3")
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.should eq("my 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.8
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-03-27 00:00:00.000000000 Z
13
+ date: 2013-04-07 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport