exiv2 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- exiv2 (0.0.7)
4
+ exiv2 (0.0.8)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -3,7 +3,14 @@
3
3
 
4
4
  // Create a Ruby string from a C++ std::string.
5
5
  static VALUE to_ruby_string(const std::string& string) {
6
- return rb_str_new(string.data(), string.length());
6
+ VALUE str = rb_str_new(string.data(), string.length());
7
+
8
+ // force UTF-8 encoding in Ruby 1.9+
9
+ ID forceEncodingId = rb_intern("force_encoding");
10
+ if(rb_respond_to(str, forceEncodingId)) {
11
+ rb_funcall(str, forceEncodingId, 1, rb_str_new("UTF-8", 5));
12
+ }
13
+ return str;
7
14
  }
8
15
 
9
16
  // Create a C++ std::string from a Ruby string.
@@ -4,8 +4,6 @@ module SharedMethods
4
4
  result = {}
5
5
 
6
6
  self.each do |key, value|
7
- key.force_encoding('utf-8')
8
- value.force_encoding('utf-8')
9
7
  if result[key]
10
8
  if result[key].is_a? Array
11
9
  result[key] << value
@@ -1,4 +1,4 @@
1
1
  # coding: utf-8
2
2
  module Exiv2
3
- VERSION = "0.0.7"
3
+ VERSION = "0.0.8"
4
4
  end
@@ -35,9 +35,22 @@ describe Exiv2 do
35
35
  image = Exiv2::ImageFactory.open(Pathname.new("spec/files/photo_with_utf8_description.jpg").to_s)
36
36
  image.read_metadata
37
37
  description = image.exif_data["Exif.Image.ImageDescription"]
38
- description.encoding.should == Encoding::UTF_8
38
+ if description.respond_to? :encoding # Only in Ruby 1.9+
39
+ description.encoding.should == Encoding::UTF_8
40
+ end
39
41
  description.should == 'UTF-8 description. ☃ł㌎'
40
42
  end
43
+
44
+ it 'reads UTF-8 data in each' do
45
+ if String.new.respond_to? :encoding # Only in Ruby 1.9+
46
+ image = Exiv2::ImageFactory.open(Pathname.new("spec/files/photo_with_utf8_description.jpg").to_s)
47
+ image.read_metadata
48
+ image.exif_data.each do |key,value|
49
+ key.encoding.should == Encoding::UTF_8
50
+ value.encoding.should == Encoding::UTF_8
51
+ end
52
+ end
53
+ end
41
54
 
42
55
  let(:image) do
43
56
  image = Exiv2::ImageFactory.open("spec/files/test.jpg")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exiv2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-23 00:00:00.000000000 Z
12
+ date: 2012-02-24 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70104251986840 !ruby/object:Gem::Requirement
16
+ requirement: &2157752580 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70104251986840
24
+ version_requirements: *2157752580
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake-compiler
27
- requirement: &70104251986260 !ruby/object:Gem::Requirement
27
+ requirement: &2157751940 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70104251986260
35
+ version_requirements: *2157751940
36
36
  description: A simple wrapper around the C++ Exiv2 libary for reading image metadata
37
37
  email:
38
38
  - pete@envato.com
@@ -42,7 +42,6 @@ extensions:
42
42
  extra_rdoc_files: []
43
43
  files:
44
44
  - .gitignore
45
- - .rbenv-version
46
45
  - .rspec
47
46
  - Gemfile
48
47
  - Gemfile.lock
@@ -74,15 +73,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
74
73
  - - ! '>='
75
74
  - !ruby/object:Gem::Version
76
75
  version: '0'
76
+ segments:
77
+ - 0
78
+ hash: 1767711018481939965
77
79
  required_rubygems_version: !ruby/object:Gem::Requirement
78
80
  none: false
79
81
  requirements:
80
82
  - - ! '>='
81
83
  - !ruby/object:Gem::Version
82
84
  version: '0'
85
+ segments:
86
+ - 0
87
+ hash: 1767711018481939965
83
88
  requirements: []
84
89
  rubyforge_project: exiv2
85
- rubygems_version: 1.8.11
90
+ rubygems_version: 1.8.10
86
91
  signing_key:
87
92
  specification_version: 3
88
93
  summary: A simple wrapper around Exiv2
@@ -1 +0,0 @@
1
- 1.9.3-p125