[imaging] Problem with read/write IPTC fields and charset

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[imaging] Problem with read/write IPTC fields and charset

Stéphane Pain

I try to read and write IPTC fields but I think I « lost » charset.

For example, before read and write IPTC fields, the PROVINCE_STATE field was Rhône-Alpes but after the value is Rh√¥ne-Alpes.

I am on Mac and my program is :

final ByteSource byteSource = new ByteSourceFile(file);
JpegPhotoshopMetadata metadata = new JpegImageParser().getPhotoshopMetadata(byteSource, null);

List<IptcBlock> newBlocks = new ArrayList<IptcBlock>();
List<IptcRecord> newRecords = new ArrayList<IptcRecord>();

if (metadata != null) {
List<IptcRecord> oldRecords = metadata.photoshopApp13Data.getRecords();
for (final IptcRecord record : oldRecords) {


PhotoshopApp13Data newData = new PhotoshopApp13Data(newRecords, newBlocks);

final File fileTmp = new File(file.getParentFile(), "test.jpg");
os = new FileOutputStream(fileTmp);
os = new BufferedOutputStream(os);
new JpegIptcRewriter().writeIPTC(file, os, newData);

Thank you for your help

Best regards