Right now detail::ustring_to_unicode_GooString() passes Unicode-encoded string to GooString constructor as a C-string. When I was testing my cpp patch for Bug 36653, I discovered that it causes poppler to save an invalid (metadata object saved after trailer dict) document after modifying metadata. Thus detail::ustring_to_unicode_GooString() should pass len to GooString constructor.
Created attachment 124388 [details] [review] cpp: pass len to GooString constructor in detail::ustring_to_unicode_GooString()
Ok, this is weird. The metadata is still doubled. But poppler reads it as it should. Sorry for not checking it previously.
Ok, so here's the thing. The thing I wrote about seems to be an unrelated bug. This patch should still be applied, because otherwise there will be encoding-related problems in the cpp frontend. The doubling of trailer dict (and metadata when modified) is a problem located in saveIncrementalUpdate(). I'm going to investigate it further and perhaps eventually file another bug about it, but for today I'm going to sleep. Cheers.
Pushed
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.