Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 8 commits
  • 13 files changed
  • 0 commit comments
  • 2 contributors
1  .gitignore
View
@@ -10,3 +10,4 @@ mkmf.log
*.dSYM
pkg
tmp
+bin
1  .rbenv-version
View
@@ -0,0 +1 @@
+1.9.3-p125
1  .rspec
View
@@ -0,0 +1 @@
+--colour
3  Gemfile
View
@@ -1,4 +1,3 @@
source "http://rubygems.org"
-# Specify your gem's dependencies in exiv2.gemspec
-gemspec
+gemspec
2  Gemfile.lock
View
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
- exiv2 (0.0.5)
+ exiv2 (0.0.6)
GEM
remote: http://rubygems.org/
1  lib/exiv2.rb
View
@@ -1,3 +1,4 @@
+# coding: utf-8
require 'exiv2/exiv2'
require 'exiv2/shared_methods'
require 'exiv2/exif_data'
1  lib/exiv2/exif_data.rb
View
@@ -1,3 +1,4 @@
+# coding: utf-8
class Exiv2::ExifData
include SharedMethods
end
1  lib/exiv2/iptc_data.rb
View
@@ -1,3 +1,4 @@
+# coding: utf-8
class Exiv2::IptcData
include SharedMethods
end
3  lib/exiv2/shared_methods.rb
View
@@ -1,8 +1,11 @@
+# coding: utf-8
module SharedMethods
def to_hash
result = {}
self.each do |key, value|
+ key.force_encoding('utf-8')
+ value.force_encoding('utf-8')
if result[key]
if result[key].is_a? Array
result[key] << value
1  lib/exiv2/version.rb
View
@@ -1,3 +1,4 @@
+# coding: utf-8
module Exiv2
VERSION = "0.0.6"
end
1  lib/exiv2/xmp_data.rb
View
@@ -1,3 +1,4 @@
+# coding: utf-8
class Exiv2::XmpData
include SharedMethods
end
10 spec/exiv2_spec.rb
View
@@ -1,3 +1,5 @@
+# coding: utf-8
+require 'bundler/setup'
require 'exiv2'
require 'fileutils'
@@ -28,6 +30,14 @@
image2.iptc_data["Iptc.Application2.Caption"].should == "A New Caption"
FileUtils.rm("spec/files/test_tmp.jpg")
end
+
+ it 'reads UTF-8 data' do
+ image = Exiv2::ImageFactory.open(Pathname.new("spec/files/photo_with_utf8_description.jpg").to_s)
+ image.read_metadata
+ description = image.exif_data["Exif.Image.ImageDescription"]
+ description.encoding.should == Encoding::UTF_8
+ description.should == 'UTF-8 description. ☃ł㌎'
+ end
let(:image) do
image = Exiv2::ImageFactory.open("spec/files/test.jpg")
BIN  spec/files/photo_with_utf8_description.jpg
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

No commit comments for this range

Something went wrong with that request. Please try again.