googleads / googleads-perl-lib

AdWords API Perl Client Library
Apache License 2.0
5 stars 19 forks source link

Error with Non-Ascii Characters in Ad Customizers #14

Closed jcb123 closed 8 years ago

jcb123 commented 8 years ago

When using client library 4.1.0 and api version v201509, adding an ad customizer value with a £ in it results in £ appearing in AdWords.

screen shot 2016-03-02 at 10 11 51 am

sundquist commented 8 years ago

Hello,

Thanks for reporting this. I'll take a look into it.

Best, Nadine Sundquist, AdWords API Team

sundquist commented 8 years ago

Hi,

I have the solution for you after a bit of experimentation. You need to have the following in your script:

use utf8;

This turns on a flag that tells Perl that there are unicode characters in your script. Otherwise, Perl has to guess when serializing your output. As you can tell, Perl doesn't always do a good job of guessing.

Cheers, Nadine, AdWords API Team

jcb123 commented 8 years ago

That did not solve the problem, unfortunately. The character went up exactly the same.

FYI I don't see the same problem with sitelinks or creatives.

sundquist commented 8 years ago

Did you put use utf8; in the same file where you are defining your prices? The way I tested it out is that I modified the add_ad_customizers.pl example to have use utf8; right after use Data::Uniqid qw(uniqid);. I then changed the $ signs to £ signs. Just adding or removing that one line changed the output for me. Perhaps, you're loading your prices in a separate module that doesn't have use utf8; in it?

Regards, Nadine

jcb123 commented 8 years ago

They are being pulled from a database, as opposed to being right in the code, but it's happening the same way for sitelinks and ads, from fields defined the same way, so it seems like the issue should be somewhere on the Perl side. I will report back if I'm able to find the issue as well.