Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add section about encodings in README.md.
  • Loading branch information
janfri committed May 21, 2014
1 parent 6c996ba commit f1d3f10
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
12 changes: 11 additions & 1 deletion .aspell.pws
@@ -1,16 +1,19 @@
personal_ws-1.1 en 72
personal_ws-1.1 en 82
StandardError
Refactoring
timestamps
Kulander
pdf
MiniExiftool
json
acki
Salzberg
jpg
SupplementalCategories
photoshop
github
iptc
MacRoman
UTF
Wil
commandline
Expand All @@ -27,11 +30,13 @@ ws
uwe
DateTime
Gieseler
aiff
Barushev
TestEscapeFilename
Regexes
robotmay
neccessary
ExifTool
exiftool
rdoc
shellwords
Expand All @@ -40,12 +45,15 @@ shioyama
warings
GPS
Horrocks
vorbis
Tempfile
exif
mie
rubyforge
regtest
Rau
Soika
png
prerelease
filenames
charset
Expand All @@ -59,6 +67,7 @@ releating
Henning
Hoy
darwin
encod
Stjernstrom
Romahn
OO
Expand All @@ -69,5 +78,6 @@ Gitorious
Soutar
Dungan
params
quicktime
POSIX
yardopts
34 changes: 34 additions & 0 deletions README.rdoc
Expand Up @@ -49,6 +49,40 @@ For further information about using MiniExiftool read the Tutorial.rdoc
in the project root folder and have a look at the examples in directory
examples.

== Encodings

In MiniExiftool all strings are encoded in UTF-8. If you need other
encodings in your project use the String#encod* methods.

If you have problems with corrupted strings when using MiniExiftool
there are two reasons for this:

=== Internal character sets

You can specify the charset in which the meta data is in the file encoded
if you read or write to some sections of meta data (i.e. IPTC, XMP ...).
It exists various options of the form *_encoding: exif, iptc, xmp, png,
id3, pdf, photoshop, quicktime, aiff, mie and vorbis.

Please read the section about the character sets of the ExifTool command
line application carefully to understand what's going on
(http://www.sno.phy.queensu.ca/~phil/exiftool/faq.html#Q10)!

# Using UTF-8 as internal encoding for IPTC tags and MacRoman as internal
# encoding for EXIF tags
photo = MiniExiftool.new('photo.jpg', iptc_encoding: 'UTF8', exif_encoding: 'MacRoman'
puts photo.caption_abstract # this value is UTF-8 encoded
puts photo.comment # this value is converted to UTF-8

=== Corrupt characters

You use the correct internal character set but in the string are still corrupt
characters.
This problem you can solve with the option replace_invalid_chars:

# Replace all invalid characters with a question mark
photo = MiniExiftool.new('photo.jpg', replace_invalid_chars: '?')

== Contribution

The code is hosted in a git repository on Gitorious at
Expand Down

0 comments on commit f1d3f10

Please sign in to comment.