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>
</RequestHeader>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<operations>
<operator>SET</operator>
<operand>
<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: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>
<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>
</RequestHeader>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<operations>
<operator>SET</operator>
<operand>
<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: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>
</RequestHeader>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<operations>
<operator>SET</operator>
<operand>
<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: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