protobuf 2.7.8 → 2.7.9

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, ::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
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protobuf
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.8
4
+ version: 2.7.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -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
@@ -500,7 +500,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
500
500
  version: '0'
501
501
  segments:
502
502
  - 0
503
- hash: -3116923197432389781
503
+ hash: -3223012257379333789
504
504
  required_rubygems_version: !ruby/object:Gem::Requirement
505
505
  none: false
506
506
  requirements:
@@ -509,7 +509,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
509
509
  version: '0'
510
510
  segments:
511
511
  - 0
512
- hash: -3116923197432389781
512
+ hash: -3223012257379333789
513
513
  requirements: []
514
514
  rubyforge_project:
515
515
  rubygems_version: 1.8.25