[Native] Special characters on body / image / title from prebid.js to DFP
Type of issue
Question
Description
We are testing native implementation from Prebid.js (1.16-pre). For this I create a simple test page with a native slot (size 1&1) and a simple mediaType declared as native. There is only appnexus in competition for the native slot. I also create a native format and style on our DFP account. What I see on my console is I get answer from Appnexus with "special characters" such as "€", "!", "*" and so on For example :
hb_native_body_appne value: Votre hôtel 5* à Rennes à partir de 167 €
DFP troubleshooting tool show me the same native body value

But I'm not able to display the body content from a simple native format / style (based on http://prebid.org/adops/setting-up-prebid-native-in-dfp.html). I put some console trace on my native style and it says body / image are empty ` console.log("HPU Version Nativ 1.0e");
console.log('HPU LinkURL :' + '%%CLICK_URL_UNESC%%%%PATTERN:hb_native_linkurl%%');
console.log('HPU Brand :' + '%%PATTERN:hb_native_brand%%');
console.log('HPU Title :' + '%%PATTERN:hb_native_title%%');
console.log('HPU Body :' + '%%PATTERN:hb_native_body%%');
console.log('HPU Image :' + '%%PATTERN:hb_native_image%%');`

As a result, the native ad is not displayed correctly

So I updated the targeting.js from prebid in order to add a fixed encodeURIComponent on the value targeted value to DFP (see function : setTargetingForGPT)

On the native style, I also add decodedURIComponent for body, brand, title and image. With those changes,

I'm able to display the native ad on the test page

Steps to reproduce
1 - Prebid.js 1.* 2 - A native ad with body / image / title including with special characters such as "€", "!" or "*"
I don't know if I missed something on the implementation (on prebid or dfp setup) or if I'm mistaken or if it's a lack of knowledge or if it's a documentation issue
Test page
With prebid.js 1.16-pre : http://www.precom-multimedia.com/interne/hpu/test_nativ2/?dfptest=50 With encodeURIComponent on Prebid and a decodeURIComponent on DFP Native Style : http://www.precom-multimedia.com/interne/hpu/test_nativ2/index_custom.html?dfptest=40
Both pages are on Prebid debug mode
Expected results
Actual results
Without encode on prebid and decode from native style, I have blank hb_native_body / image
Platform details
PRebid 1.16-pre, Prebid 1.15 Chrome / Firefox (last versions)
Other information
Thanks for the bug report. Would you mind opening a PR to resolve?
Thanks for the feedback, I never opened a pull request. I'll try to do it.
FYI, we built our own Prebid.js including encodeURIComponent on native key (impact on utils.js and targeting.js). So that we can decode them on DFP Native style and use a document.write to render the native ad. We also update DFP lineItems so that we can receive SendallBids-> false. Our custom Prebid.js is live on one of our production site with one native position : https://rennes.maville.com/ . We are monitoring the prebid / DFP on this site.
@haroldpussat , have you opened a pull request for this change?
https://github.com/prebid/Prebid.js/pull/3224 is an attempt to fix this.