Ran exiftool on this photo. If I generate a json output, I see the following characters ....
exiftool -j -n R0038515.JPG > e.json
"InternalSerialNumber": "\u0000d\u0000\u0000\u0002X\u0000\u0000\u0000dRicoh\u0000",
in plain I see ...
exiftool -n R0038515.JPG | grep -i serial
Internal Serial Number : d.XdRicoh
exiftool R0038515.JPG | grep -i serial
Internal Serial Number : 006400000258000000645269636f6800
in xml I see
exiftool -n -X R0038515.JPG
<Ricoh:InternalSerialNumber rdf:datatype='http://www.w3.org/2001/XMLSchema#base64Binary'>
AGQAAAJYAAAAZFJpY29oAA==
</Ricoh:InternalSerialNumber>
exiftool -X R0038515.JPG
<Ricoh:InternalSerialNumber>006400000258000000645269636f6800</Ricoh:InternalSerialNumber>
When this data gets converted to xml by our server, the client gets a XML decoding errors.
I have attached the source JPG.
HTTP/1.1 200 OK
Date: Sun, 08 Apr 2012 11:10:54 GMT
Server: Apache/2.2.15 (CentOS)
X-Powered-By: PHP/5.3.3
P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"
Content-Type: application/xml; charset=utf-8
Cache-Control: proxy-revalidate
Content-Length: 5297
Proxy-Connection: Keep-Alive
Connection: Keep-Alive
<?xml version="1.0" encoding="UTF-8"?>
<response>
<Id>8fe256cbae253e6043a588c9c0ec3450</Id>
<IdOwner>1d8fa39a5b970237</IdOwner>
<Name>R0038515.JPG</Name>
<Caption />
<MimeType>image/jpeg</MimeType>
<Metadata>
<oldMetadata />
<device>
<make>RICOH</make>
<model>GR DIGITAL 4</model>
</device>
</Metadata>
<IsPanoramic>0</IsPanoramic>
<ExifInfo>
<SourceFile>/tmp/phpyNXRWt</SourceFile>
<FileName>phpyNXRWt</FileName>
<FileSize>532157</FileSize>
<FileModifyDate>2012:04:08 04:03:32-07:00</FileModifyDate>
<FileType>JPEG</FileType>
<MIMEType>image/jpeg</MIMEType>
<JFIFVersion>1 1</JFIFVersion>
<ExifByteOrder>MM</ExifByteOrder>
<ImageDescription> </ImageDescription>
<Make>RICOH</Make>
<Model>GR DIGITAL 4</Model>
<XResolution>72</XResolution>
<YResolution>72</YResolution>
<ResolutionUnit>2</ResolutionUnit>
<Software>GR Firmware</Software>
<ModifyDate>2012:03:24 18:29:02</ModifyDate>
<Artist>Picasa</Artist>
<YCbCrPositioning>2</YCbCrPositioning>
<Copyright />
<ExposureTime>0.0008695652174</ExposureTime>
<FNumber>3.2</FNumber>
<ExposureProgram>2</ExposureProgram>
<ISO>80</ISO>
<SensitivityType>1</SensitivityType>
<ExifVersion>0230</ExifVersion>
<DateTimeOriginal>2012:02:20 10:21:42</DateTimeOriginal>
<CreateDate>2012:02:20 10:21:42</CreateDate>
<ComponentsConfiguration>1 2 3 0</ComponentsConfiguration>
<CompressedBitsPerPixel>2.8</CompressedBitsPerPixel>
<ApertureValue>3.138336391587</ApertureValue>
<BrightnessValue>8.4</BrightnessValue>
<ExposureCompensation>0</ExposureCompensation>
<MaxApertureValue>1.9318726578497</MaxApertureValue>
<MeteringMode>5</MeteringMode>
<LightSource>0</LightSource>
<Flash>16</Flash>
<FocalLength>6</FocalLength>
ZZ
<MakerNoteType>Rdc</MakerNoteType>
<FirmwareVersion />
<InternalSerialNumber>�d��X���dRicoh�</InternalSerialNumber> <==== xml errors
Can someone confirm what a Ricoh camera serial number is suposed to look like? Thank you.
Your server isn't doing the conversion correctly because it is leaving invalid characters in the XML output. ExifTool deals with these by encoding in base64 if necessary, as you have seen.
The metadata for the image you posted has been corrupted by editing with Picasa. Unfortunately, Picasa is well known for corrupting metadata, and has a long history of creating problems like this. I can see that the serial number of this camera is actually 2015000000103558, but the maker note offsets are messed up so ExifTool extracts the wrong value.
- Phil
Phil, Thank you for your comments. As a work-around I will change our code to produce XML metadata for this file rather than json. Subsequently the meta data is converted to an object and then becomes part of the xml response when the image is viewed.
I think I should also change ExifTool to convert the serial number to text without the -n option because some other models will produce funny characters like this even if the file isn't corrupted.
But in general, one should be able to deal with funny characters in the exiftool output because I don't guarantee that they won't occur.
- Phil