Currency symbol errors when setting params

141 views
Skip to first unread message

Neil Kirk

unread,
Feb 21, 2012, 4:24:37 AM2/21/12
to adwor...@googlegroups.com
Hi there,

I am getting Content-Length header value was wrong errors when trying to set a price as a parameter insertion text. It works fine with the USD '$' symbol, but it doesn't work with the GBP '£':
my $ad_param1 = Google::Ads::AdWords::v201109::AdParam->new({
adGroupId => $ad_group_id,
criterionId => $keyword_id,
insertionText=>'£1.00',
paramIndex => "1",
});

[21 Feb 2012 08:13:13,180 - INFO ] Outgoing Request:
<SOAP-ENV:Header>
<authToken xmlns="https://adwords.google.com/api/adwords/cm/v201109">REDACTED</authToken>
<clientCustomerId xmlns="https://adwords.google.com/api/adwords/cm/v201109">4094931487</clientCustomerId>
<developerToken xmlns="https://adwords.google.com/api/adwords/cm/v201109">REDACTED</developerToken>
<userAgent xmlns="https://adwords.google.com/api/adwords/cm/v201109">AwApi-Perl-2.5.5|skeniver</userAgent>
<validateOnly xmlns="https://adwords.google.com/api/adwords/cm/v201109">false</validateOnly>
<partialFailure xmlns="https://adwords.google.com/api/adwords/cm/v201109">false</partialFailure>
</RequestHeader>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<operations>
<operator>SET</operator>
<operand>
<adGroupId>3065323636</adGroupId>
<criterionId>26364927</criterionId>
<insertionText>£1.00</insertionText>
<paramIndex>1</paramIndex>
</operand>
</operations>
</mutate>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

[21 Feb 2012 08:13:13,498 - INFO ] Incoming response:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<requestId>0004b974fed494600a0c981400002879</requestId>
<serviceName>AdParamService</serviceName>
<methodName>mutate</methodName>
<operations>1</operations>
<responseTime>77</responseTime>
<units>1</units>
</ResponseHeader>
</soap:Header>
<soap:Body>
<rval>
<adGroupId>3065323636</adGroupId>
<criterionId>26364927</criterionId>
<insertionText>£1.00</insertionText>
<paramIndex>1</paramIndex>
</rval>
</mutateResponse>
</soap:Body>
</soap:Envelope>

It does seem to work with the EUR '€' when I hard coded it like this:
my $ad_param1 = Google::Ads::AdWords::v201109::AdParam->new({
adGroupId => $ad_group_id,
criterionId => $keyword_id,
insertionText=>'€1.00',
paramIndex => "1",
});

The get_insertionText from the returned params is €1.00.

But when I try pass in a variable, it doesn't work either. The variable is pulled from a database, so maybe there are some encoding issues, but here is the code and logs (the value of $display_price is "€1.00":
my $ad_param1 = Google::Ads::AdWords::v201109::AdParam->new({
adGroupId => $ad_group_id,
criterionId => $keyword_id,
insertionText=>$display_price,
paramIndex => "1",
});


[21 Feb 2012 08:40:56,537 - INFO ] Outgoing Request:
<SOAP-ENV:Header>
<authToken xmlns="https://adwords.google.com/api/adwords/cm/v201109">REDACTED</authToken>
<clientCustomerId xmlns="https://adwords.google.com/api/adwords/cm/v201109">4094931487</clientCustomerId>
<developerToken xmlns="https://adwords.google.com/api/adwords/cm/v201109">REDACTED</developerToken>
<userAgent xmlns="https://adwords.google.com/api/adwords/cm/v201109">AwApi-Perl-2.5.5|skeniver</userAgent>
<validateOnly xmlns="https://adwords.google.com/api/adwords/cm/v201109">false</validateOnly>
<partialFailure xmlns="https://adwords.google.com/api/adwords/cm/v201109">false</partialFailure>
</RequestHeader>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<operations>
<operator>SET</operator>
<operand>
<adGroupId>3065323636</adGroupId>
<criterionId>26364927</criterionId>
<insertionText>Ä0.004</insertionText>
<paramIndex>1</paramIndex>
</operand>
</operations>
</mutate>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

[21 Feb 2012 08:40:56,782 - INFO ] Incoming response:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>Unmarshalling Error: ParseError at [row,col]:[1,1355]
Message: Invalid byte 1 of 1-byte UTF-8 sequence. </faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>

I also tried to make sure the $display_price variable was a string by passing it in quote marks:
    my $ad_param1 = Google::Ads::AdWords::v201109::AdParam->new({
        adGroupId => $ad_group_id,
        criterionId => $keyword_id,
insertionText=>"$display_price",
        paramIndex => "1",
    });

But still get the error:
[21 Feb 2012 09:13:52,672 - INFO ] Outgoing Request:
<SOAP-ENV:Header>
<authToken xmlns="https://adwords.google.com/api/adwords/cm/v201109">REDACTED</authToken>
<clientCustomerId xmlns="https://adwords.google.com/api/adwords/cm/v201109">4094931487</clientCustomerId>
<developerToken xmlns="https://adwords.google.com/api/adwords/cm/v201109">REDACTED</developerToken>
<userAgent xmlns="https://adwords.google.com/api/adwords/cm/v201109">AwApi-Perl-2.5.5|skeniver</userAgent>
<validateOnly xmlns="https://adwords.google.com/api/adwords/cm/v201109">false</validateOnly>
<partialFailure xmlns="https://adwords.google.com/api/adwords/cm/v201109">false</partialFailure>
</RequestHeader>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<operations>
<operator>SET</operator>
<operand>
<adGroupId>3065323636</adGroupId>
<criterionId>26364927</criterionId>
<insertionText>Ä0.004</insertionText>
<paramIndex>1</paramIndex>
</operand>
</operations>
</mutate>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


[21 Feb 2012 09:13:52,924 - INFO ] Incoming response:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>Unmarshalling Error: ParseError at [row,col]:[1,1355]
Message: Invalid byte 1 of 1-byte UTF-8 sequence. </faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>

I need to be able to set params with '£' and '€' currencies. Please help me with this

Eric Koleda

unread,
Feb 23, 2012, 10:21:44 PM2/23/12
to adwor...@googlegroups.com
Hi Neil,

It seems the problem with the requests is incorrect UTF-8 encoding.  I'm not familiar enough with Perl to provide language-specific advice, but I wrote up some help material for the PHP client library that may be relevant:


Specifically, you can use XML character entities to represent these special characters, such as &#x20AC; for the symbol.

Best,
- Eric Koleda, AdWords API Team
Reply all
Reply to author
Forward
0 new messages