<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>159220</bug_id>
          
          <creation_ts>2008-03-13 01:02:53 +0000</creation_ts>
          <short_desc>Non printable characters in IPTC keyword set by digiKam (UTF-8 support with IPTC metadata) [patch]</short_desc>
          <delta_ts>2017-08-13 07:31:33 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Applications</classification>
          <product>digikam</product>
          <component>Metadata-Iptc</component>
          <version>0.9.2</version>
          <rep_platform>Ubuntu</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Jean-Marc Liotier">jm</reporter>
          <assigned_to name="Digikam Developers">digikam-bugs-null</assigned_to>
          <cc>caulier.gilles</cc>
    
    <cc>colin</cc>
    
    <cc>ebayard63-projet</cc>
    
    <cc>kde_bugs</cc>
    
    <cc>msylwester</cc>
          
          <cf_commitlink>http://commits.kde.org/libkexiv2/e4cfee882303b50f17e6301a9fa7e00ab821336b</cf_commitlink>
          <cf_versionfixedin>4.0.0</cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>586529</commentid>
    <comment_count>0</comment_count>
    <who name="Jean-Marc Liotier">jm</who>
    <bug_when>2008-03-13 01:02:53 +0000</bug_when>
    <thetext>Version:           0.9.2-final (using KDE 3.5.8)
Installed from:    Ubuntu Packages
OS:                Linux

Example at http://gallery.ruwenzori.net/main.php/v/travel/SenegalPaulineVelo2008/20080228_113839_1454_SenegalPaulineVelo.jpg.html :

Look at the &quot;IPTC: Keywords&quot; field in the &quot;Photo Properties&quot; details. You&apos;ll notice that all tags are like &quot;Transport/bicycle�;&quot; with the &quot;white interrogation mark on black hexagon&quot; character just before the semicolon. All those tags were generated using Digikam.

Counter example at http://gallery.ruwenzori.net/main.php/v/misc/debugging/20080301_113020_1640_SenegalPaulineVelo-bis.jpg.html :

Look at the same field. The ones with the same problem were also generated using Digikam. The clean ones were added using exiv2 from the command line.

Several hypothesis are credible :
- Digikam produces perfectly good tags but Gallery 2 somehow misinterprets them. This seems invalidated by the clean tags produced by exiv2 which a reasonably trusted implementation.
- Digikam produces tags with an illegal non-printable character.

Note that this is not a browser character set problem : whether I force UTF-8 or ISO-8859-1 as the character encoding for rendering the page, the special character is always there.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>586558</commentid>
    <comment_count>1</comment_count>
    <who name="">caulier.gilles</who>
    <bug_when>2008-03-13 06:25:39 +0000</bug_when>
    <thetext>digiKam always use ascii characters set to generate IPTC text field

Gilles Caulier</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>586592</commentid>
    <comment_count>2</comment_count>
    <who name="Jean-Marc Liotier">jm</who>
    <bug_when>2008-03-13 11:23:37 +0000</bug_when>
    <thetext>So you think that this is rather a rendering problem on the Gallery 2 side ?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>586593</commentid>
    <comment_count>3</comment_count>
    <who name="">caulier.gilles</who>
    <bug_when>2008-03-13 11:26:14 +0000</bug_when>
    <thetext>Yes...

Gilles</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>586594</commentid>
    <comment_count>4</comment_count>
    <who name="">caulier.gilles</who>
    <bug_when>2008-03-13 11:34:32 +0000</bug_when>
    <thetext>Or if you have used GalleryExport kipi-plugin, a problem relevant of this tool...

Colin, What do you think about ?

Gilles</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>586595</commentid>
    <comment_count>5</comment_count>
    <who name="Jean-Marc Liotier">jm</who>
    <bug_when>2008-03-13 11:39:16 +0000</bug_when>
    <thetext>No use of the GalleryExport kipi-plugin : I copied the files to the server through scp and I imported them into Gallery 2 from there.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>586596</commentid>
    <comment_count>6</comment_count>
    <who name="Jean-Marc Liotier">jm</who>
    <bug_when>2008-03-13 11:39:33 +0000</bug_when>
    <thetext>I opened a ticket in the Gallery 2 project. I&apos;ll let you know how it goes.
http://sourceforge.net/tracker/index.php?func=detail&amp;aid=1913414&amp;group_id=7130&amp;atid=107130</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>675347</commentid>
    <comment_count>7</comment_count>
    <who name="">caulier.gilles</who>
    <bug_when>2008-12-04 20:54:13 +0000</bug_when>
    <thetext>Jean Marc,

What&apos;s news about this report ?

Gilles Caulier</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>678204</commentid>
    <comment_count>8</comment_count>
    <who name="Andrea Diamantini">adjam7</who>
    <bug_when>2008-12-09 00:29:16 +0000</bug_when>
    <thetext>Probably fixed with commit 882181. Can you please try again and let me know?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>706954</commentid>
    <comment_count>9</comment_count>
    <who name="Ian Hubbertz">kde_bugs</who>
    <bug_when>2009-01-28 23:03:20 +0000</bug_when>
    <thetext>Maybe its a similar problem as 149029 ?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>772325</commentid>
    <comment_count>10</comment_count>
    <who name="">caulier.gilles</who>
    <bug_when>2009-06-09 12:17:05 +0000</bug_when>
    <thetext>Jean Marc,

digiKam &gt; 0.9.x support XMP. XMP replace IPTC and support UTF-8. IPTC has never supported UTF-8 and have several limitation over strings size. XMP do not have these limitation. 

Gallery server must support XMP by default and use it as well instead IPTC.

Gilles Caulier</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>772473</commentid>
    <comment_count>11</comment_count>
    <who name="Mikolaj Machowski">mikmach</who>
    <bug_when>2009-06-09 17:10:22 +0000</bug_when>
    <thetext>True, IPTC is becoming obsolete but it is still used in $BIGNUMBER of programs and digiKam should be able to play with it nicely.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>795353</commentid>
    <comment_count>12</comment_count>
    <who name="">caulier.gilles</who>
    <bug_when>2009-07-20 11:17:32 +0000</bug_when>
    <thetext>Jean Marc,

In Gallery Export plugin comming with kipi-plugins 0.4.0, i have fixed code to preserve metadata of exported and resized images.

Can you test with this version ?

Gilles Caulier</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1200591</commentid>
    <comment_count>13</comment_count>
    <who name="">caulier.gilles</who>
    <bug_when>2011-12-16 16:34:30 +0000</bug_when>
    <thetext>Jean Marc,

Do you see my comment #12 ?

Gilles Caulier</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1423038</commentid>
    <comment_count>14</comment_count>
    <who name="Eric Bayard">ebayard63-projet</who>
    <bug_when>2014-01-06 14:17:12 +0000</bug_when>
    <thetext>(In reply to comment #10)
&gt; Jean Marc,
&gt; 
&gt; digiKam &gt; 0.9.x support XMP. XMP replace IPTC and support UTF-8. IPTC has
&gt; never supported UTF-8 and have several limitation over strings size. XMP do
&gt; not have these limitation. 
&gt; 
&gt; Gallery server must support XMP by default and use it as well instead IPTC.
&gt; 
&gt; Gilles Caulier

Hi Gilles,
Actually this is wrong. UFT is officially part of IPTC standard since 1997 (XMP were first used in 2001 by adobe in acrobat)

You can find a lot of publication on this subject. But the best is to directly check the standard on the IPTC website. Note that tha latest IPTC standard are based on XMP implementation, but this not what we are dicussing here.

example: 
http://www.gwww.wan-ifra.org%2Fsystem%2Ffiles%2Ffield_ifra_mag_file%2FF_tp980258.pdf&amp;ei=BrXKUq_HEYGshQeBmoHwBg&amp;usg=AFQjCNHAaCBNHuKLvObVXCLL-ZlWs4TrTQ&amp;sig2=JdQvFsrXcaKJOOz-ieanoA&amp;bvm=bv.58187178,d.ZG4
 
or quoted from: http://www.iptc.org/std/IIM/4.1/specification/IIMV4.1.pdf  (year 1999)

 &quot;Coded
Character
Set
Optional, not repeatable, up to 32 octets, consisting of one or
more control functions used for the announcement, invocation or
designation of coded character sets. The control functions follow
the ISO 2022 standard and may consist of the escape control
character and one or more graphic characters. For more details
see Appendix C, the IPTC-NAA Code Library.
The control functions apply to character oriented DataSets in
records 2-6. They also apply to record 8, unless the objectdata
explicitly, or the File Format implicitly, defines character sets
otherwise.
If this DataSet contains the designation function for Unicode in
UTF-8 then no other announcement, designation or invocation
functions are permitted in this DataSet or in records 2-6.
For all other character sets, one or more escape sequences are
used....&quot;

or from the metadata working group that sets the standards and use them of course:
www.metadataworkinggroup.com/pdf/mwg_guidance.pdf  page 28 (Note that the whole section is very interesting for digikam as it speaks about metadata reconciliation guidance)

&quot;IPTC-IIM SHOULD be written using the Coded Character Set (1:90) as UTF-8 (see “Section 1.6 Coded Character Set” in the IIM specification).

If the IPTC-IIM has not been written in UTF-8 before, a robust Changer SHOULD convert all properties to UTF-8 and write the corresponding identifier for UTF-8 to the 1:90 DataSet...

In a word  DIGIKAM is not standard compliant
It  makes it incompatible with all other image management software, such as those from adobe. 
It also corrupts our metadata which really is a shame because it is still a really good piece of software

Regards
Eric</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1423040</commentid>
    <comment_count>15</comment_count>
    <who name="">caulier.gilles</who>
    <bug_when>2014-01-06 14:24:39 +0000</bug_when>
    <thetext>Well, don&apos;t forget that digiKAm do not write IPTC metadata in file. All is delegate to Exiv2. We pass UTF-8 string to exiv2 which choose the best way to store data in right fomat.

If Exiv2 support this IPTC feature, why not. I pretty sure that Exiv2 don&apos;t do it.

Please report this problem to Exiv2 bugzilla first.

Gilles Caulier</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1433085</commentid>
    <comment_count>16</comment_count>
    <who name="Michal Sylwester">msylwester</who>
    <bug_when>2014-02-28 05:07:13 +0000</bug_when>
    <thetext>I had similar problem to original one: after metadata sync from images to DB I was getting a lot of tags with all non-ascii characters converted to &quot;?&quot; in addition to correct ones. exiftool helped me to trace this to the IPTC tags, hence here I am.

I tried to follow up on where exactly the characters are replaced by &quot;?&quot; and it seems to be KExiv2::setIptcKeywords , where it uses toLatin1() which works exactly this way. Some changes around to change it to Utf8 made it pass my test case. When I made digikam use the modified lib it wrote the tags correctly, but they were still displayed garbled in the tags panel.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1433087</commentid>
    <comment_count>17</comment_count>
      <attachid>85355</attachid>
    <who name="Michal Sylwester">msylwester</who>
    <bug_when>2014-02-28 05:18:28 +0000</bug_when>
    <thetext>Created attachment 85355
Added/changed IPTC keywords conversion to/from utf8</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1433088</commentid>
    <comment_count>18</comment_count>
      <attachid>85356</attachid>
    <who name="Michal Sylwester">msylwester</who>
    <bug_when>2014-02-28 05:21:48 +0000</bug_when>
    <thetext>Created attachment 85356
My test case

With modified library input/output is consistent with using exiftool from command line.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1433588</commentid>
    <comment_count>19</comment_count>
      <attachid>85394</attachid>
    <who name="Michal Sylwester">msylwester</who>
    <bug_when>2014-03-03 06:17:02 +0000</bug_when>
    <thetext>Created attachment 85394
Use UTF-8 when reading/writing IPTC, set charset to UTF-8.

I did a little more digging, and it seems that to store UTF-8 in IPTC it is necessary to set IPTC:CodedCharacterSet to &quot;\33%G&quot;, otherwise it&apos;s still ASCII. I&apos;ve updated my path to always read and save as UTF8. Conversion ASCII-&gt;UTF8 when reading should be safe. Every time a field is changed the charset is set to UTF8, so writing should be fine as well. I think it&apos;s an overkill but checking all the characters every time is perhaps even worse.

Apparently, other charsets could also be supported, but I couldn&apos;t find any details...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1433598</commentid>
    <comment_count>20</comment_count>
    <who name="">caulier.gilles</who>
    <bug_when>2014-03-03 08:50:12 +0000</bug_when>
    <thetext>Git commit e4cfee882303b50f17e6301a9fa7e00ab821336b by Gilles Caulier.
Committed on 03/03/2014 at 08:47.
Pushed by cgilles into branch &apos;master&apos;.

Review and apply patch #85394 from Michal Sylwester about to support UTF-8 encoding/decoding with IPTC metadata.
Tested with non UTF8 IPTC image. Char still decoded as ASCII if Iptc.Envelope.CharacterSet is not present.
FIXED-IN: 4.0.0

M  +72   -37   libkexiv2/kexiv2iptc.cpp

http://commits.kde.org/libkexiv2/e4cfee882303b50f17e6301a9fa7e00ab821336b</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>85355</attachid>
            <date>2014-02-28 05:18:28 +0000</date>
            <delta_ts>2014-03-03 06:17:02 +0000</delta_ts>
            <desc>Added/changed IPTC keywords conversion to/from utf8</desc>
            <filename>IPTC.path</filename>
            <type>text/plain</type>
            <size>1651</size>
            <attacher name="Michal Sylwester">msylwester</attacher>
            
              <data encoding="base64">LS0tIC4uLy4uL2RpZ2lrYW0tNC4wLjAtYmV0YTMvZXh0cmEvbGlia2V4aXYyL2xpYmtleGl2Mi9r
ZXhpdjJpcHRjLmNwcAkyMDE0LTAyLTA5IDE4OjA0OjQyLjAwMDAwMDAwMCArMDkwMAorKysgbGli
a2V4aXYyL2tleGl2MmlwdGMuY3BwCTIwMTQtMDItMjggMTM6Mzc6MjAuODI4NjUwMDU1ICswOTAw
CkBAIC00OTAsNyArNDkwLDcgQEAKIAogICAgICAgICAgICAgICAgIGlmIChrZXkgPT0gUVN0cmlu
ZygiSXB0Yy5BcHBsaWNhdGlvbjIuS2V5d29yZHMiKSkKICAgICAgICAgICAgICAgICB7Ci0gICAg
ICAgICAgICAgICAgICAgIFFTdHJpbmcgdmFsKGl0LT50b1N0cmluZygpLmNfc3RyKCkpOworICAg
ICAgICAgICAgICAgICAgICBRU3RyaW5nIHZhbCA9IFFTdHJpbmc6OmZyb21VdGY4KGl0LT50b1N0
cmluZygpLmN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yZHMgdG8gYXZvaWQgZHVwbGlj
YXRlcy4gVGhleSB3aWxsIGJlIGFkZGVkIGFnYWluIGJlbG93LgogICAgICAgICAgICAgaWYgKCBr
ZXkgPT0gUVN0cmluZygiSXB0Yy5BcHBsaWNhdGlvbjIuS2V5d29yZHMiKSAmJgpAQCAtNTQ3LDcg
KzU0Nyw3IEBACiAgICAgICAgICAgICBrZXkudHJ1bmNhdGUoNjQpOwogCiAgICAgICAgICAgICBF
eGl2Mjo6VmFsdWU6OkF1dG9QdHIgdmFsID0gRXhpdjI6OlZhbHVlOjpjcmVhdGUoRXhpdjI6OnN0
cmluZyk7Ci0gICAgICAgICAgICB2YWwtPnJlYWQoa2V5LnRvTGF0aW4xKCkuY29uc3REYXRhKCkp
OworICAgICAgICAgICAgdmFsLT5yZWFkKGtleS50b1V0ZjgoKS5jb25zdERhdGEoKSk7CiAgICAg
ICAgICAgICBpcHRjRGF0YS5hZGQoaXB0Y1RhZywgdmFsLmdldCgpKTsKICAgICAgICAgfQogCg==
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>85356</attachid>
            <date>2014-02-28 05:21:48 +0000</date>
            <delta_ts>2014-02-28 05:21:48 +0000</delta_ts>
            <desc>My test case</desc>
            <filename>test.cpp</filename>
            <type>text/x-c++src</type>
            <size>437</size>
            <attacher name="Michal Sylwester">msylwester</attacher>
            
              <data encoding="base64">I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8UURlYnVnPgojaW5jbHVkZSAibGlia2V4aXYy
L2xpYmtleGl2Mi9rZXhpdjIuaCIKCnVzaW5nIG5hbWVzcGFjZSBLRXhpdjJJZmFjZTsKCmludCBt
YWluKCkgewogICAgUVN0cmluZyBmaWxlbmFtZSgiaW1nXzIyOTkuanBnIik7CiAgICBLRXhpdjIg
ZGF0YShmaWxlbmFtZSk7IAogICAgUVN0cmluZ0xpc3Qga2V5d29yZHMgPSBkYXRhLmdldElwdGNL
ZXl3b3JkcygpOwogICAgcURlYnVnKCkgPDwgIlJlYWQ6ICIgPDwga2V5d29yZHM7CiAgICBRU3Ry
aW5nTGlzdCBuZXdrZXl3b3JkczsKICAgIG5ld2tleXdvcmRzLmFwcGVuZChRU3RyaW5nOjpmcm9t
VXRmOCgi55S75YOPIikpOwogICAgZGF0YS5zZXRJcHRjS2V5d29yZHMoa2V5d29yZHMsIG5ld2tl
eXdvcmRzKTsKCiAgICBkYXRhLmFwcGx5Q2hhbmdlcygpOwp9Cgo=
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>85394</attachid>
            <date>2014-03-03 06:17:02 +0000</date>
            <delta_ts>2014-03-03 06:17:02 +0000</delta_ts>
            <desc>Use UTF-8 when reading/writing IPTC, set charset to UTF-8.</desc>
            <filename>IPTC.path</filename>
            <type>text/plain</type>
            <size>6084</size>
            <attacher name="Michal Sylwester">msylwester</attacher>
            
              <data encoding="base64">LS0tIC4uLy4uL2RpZ2lrYW0tNC4wLjAtYmV0YTMvZXh0cmEvbGlia2V4aXYyL2xpYmtleGl2Mi9r
ZXhpdjJpcHRjLmNwcAkyMDE0LTAyLTA5IDE4OjA0OjQyLjAwMDAwMDAwMCArMDkwMAorKysgbGli
a2V4aXYyL2tleGl2MmlwdGMuY3BwCTIwMTQtMDMtMDMgMTU6MDU6MDEuMTgwOTQ1NzYwICswOTAw
CkBAIC0xNDYsNyArMTQ2LDE2IEBACiAgICAgICAgICAgICAvLyBEZWNvZGUgdGhlIHRhZyB2YWx1
ZSB3aXRoIGEgdXNlciBmcmllbmRseSBvdXRwdXQuCiAgICAgICAgICAgICBzdGQ6Om9zdHJpbmdz
dHJlYW0gb3M7CiAgICAgICAgICAgICBvcyA8PCAqbWQ7Ci0gICAgICAgICAgICBRU3RyaW5nIHZh
bHVlID0gUVN0cmluZyhvcy5zdHIoKS5jX3N0cigpKTsKKyAgICAgICAgICAgCisgICAgICAgICAg
ICBRU3RyaW5nIHZhbH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pOworICAgICAgICAgICAgdmFsLT5yZWFkKGtleS50b1V0ZjgoKS5jb25zdERhdGEoKSk7
CiAgICAgICAgICAgICBpcHRjRGF0YS5hZGQoaXB0Y1RhZywgdmFsLmdldCgpKTsKICAgICAgICAg
fQotCiAgICAgICAgIGQtPmlwdGNNZXRhZGF0YSgpID0gaXB0Y0RhdGE7CiAKKyAgICAgICAgLy8g
TWFrZSBzdXJlIGNoYXJhY3RlciBzZXQgaXMgVVRGLTgKKyAgICAgICAgc2V0SXB0Y1RhZ1N0cmlu
ZygiSXB0Yy5FbnZlbG9wZS5DaGFyYWN0ZXJTZXQiLCAiXDMzJUciLCBmYWxzZSk7CisKICAgICAg
ICAgcmV0dXJuIHRydWU7CiAgICAgfQogICAgIGNhdGNoKCBFeGl2Mjo6RXJyb3ImIGUgKQpAQCAt
NDkwLDExICs1MDQsMTMgQEAKIAogICAgICAgICAgICAgICAgIGlmIChrZXkgPT0gUVN0cmluZygi
SXB0Yy5BcHBsaWNhdGlvbjIuS2V5d29yZHMiKSkKICAgICAgICAgICAgICAgICB7Ci0gICAgICAg
ICAgICAgICAgICAgIFFTdHJpbmcgdmFsKGl0LT50b1N0cmluZygpLmNfc3RyKCkpOworICAgICAg
ICAgICAgICAgICAgICBRU3RyaW5nIHZhbCA9IFFTdHJpbmc6OmZyb21VdGY4KGl0LT50b1N0cmlu
ZygpLmNfc3RyKCkpOwogICAgICAgICAgICAgICAgICAgICBrZXl3b3Jkcy5hcHBlbmQodmFsKTsK
ICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAKKyAgICAgICAgICAgIGtEZWJ1Zygp
IDw8IGQtPmZpbGVQYXRoCisgICAgICAgICAgICAgICAgPDwgIiA9PT4gUmVhZCBJcHRjIEtleXdv
cmRzOiAiIDw8IGtleXdvcmRzOwogICAgICAgICAgICAgcmV0dXJuIGtleXdvcmRzOwogICAgICAg
ICB9CiAgICAgfQpAQCAtNTE3LDggKzUzMyw4IEBACiAgICAgICAgIFFT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KKyAgICAgICAgICAg
IFFTdHJpbmcgdmFsID0gUVN0cmluZzo6ZnJvbVV0ZjgoaXQtPnRvU3RyaW5nKCkuY19zdHIoKSk7
CiAKICAgICAgICAgICAgIGlmIChrZXkgPT0gUVN0cmluZygiSXB0Yy5BcHBsaWNhdGlvbjIuU3Vw
cENhdGVnb3J5IikgJiYgb2xkU3ViQ2F0ZWdvcmllcy5jb250YWlucyh2YWwpKQogICAgICAgICAg
ICAgICAgIGl0ID0gaXB0Y0RhdGEuZXJhc2UoaXQpOwpAQCAtNzE0LDEyICs3MzYsMTUgQEAKICAg
ICAgICAgICAgIGtleS50cnVuY2F0ZSgzMik7CiAKICAgICAgICAgICAgIEV4aXYyOjpWYWx1ZTo6
QXV0b1B0ciB2YWwgPSBFeGl2Mjo6VmFsdWU6OmNyZWF0ZShFeGl2Mjo6c3RyaW5nKTsKLSAgICAg
ICAgICAgIHZhbC0+cmVhZChrZXkudG9MYXRpbjEoKS5jb25zdERhdGEoKSk7CisgICAgICAgICAg
ICB2YWwtPnJlYWQoa2V5LnRvVXRmOCgpLmNvbnN0RGF0YSgpKTsKICAgICAgICAgICAgIGlwdGNE
YXRhLmFkZChpcHRjVGFnLCB2YWwuZ2V0KCkpOwogICAgICAgICB9CiAKICAgICAgICAgZC0+aXB0
Y01ldGFkYXRhKCkgPSBpcHRjRGF0YTsKIAorICAgICAgICAvLyBNYWtlIHN1cmUgY2hhcmFjdGVy
IHNldCBpcyBVVEYtOAorICAgICAgICBzZXRJcHRjVGFnU3RyaW5nKCJJcHRjLkVudmVsb3BlLkNo
YXJhY3RlclNldCIsICJcMzMlRyIsIGZhbHNlKTsKKyAgICAgICAgCiAgICAgICAgIHJldHVybiB0
cnVlOwogICAgIH0KICAgICBjYXRjaCggRXhpdjI6OkVycm9yJiBlICkK
</data>

          </attachment>
      

    </bug>

</bugzilla>