Small correction: in 1):

In UAT-8 this é sign would be the bytes "c3 a9".

I meant

In UTF-8 this é sign would be the bytes "c3 a9".

The two questions are below.

Many thanks in advance.



On Mon, Oct 31, 2011 at 12:25 PM, Peter Petrov <p.a.pet...@gmail.com> wrote:

> Hello,
>
> I use Java. In the old V13 reporting API when scheduling search query
> report I used to get values like:
>
> Query="curtains curtains blinds &amp; shades home d&#233;cor home"
>
> This &#233; is this symbol:
> http://en.wikipedia.org/wiki/%C3%89
> (lower case)
>
> In the new API
> your reference Java implementation says we should do this
>     if (response == HttpURLConnection.HTTP_OK) {
>       File f = createTempFile();
>       BufferedOutputStream output = new BufferedOutputStream(new
> FileOutputStream(f));
>       copy(conn.getInputStream(), output);
>       output.close();
>       return f;
>     } else {
>       ByteArrayOutputStream baos = new ByteArrayOutputStream();
>       BufferedOutputStream output = new BufferedOutputStream(baos);
>       copy(conn.getInputStream(), output);
>       output.close();
>       throw new HttpException(response, baos.toString());
>     }
>
> For my own implementation I transformed this code into
>
>         if (response == HttpURLConnection.HTTP_OK) {
>             ByteArrayOutputStream bos = new ByteArrayOutputStream(1024);
>             copy(conn.getInputStream(), bos);
>             bos.flush();
>             bos.close();
>             StringBuffer str = new StringBuffer(bos.toString("UTF-8"));
>
> .....
>
> }else{
>
> ....
>
> }
>
>
> Then I get wrong values in my XML file
>
> So
>
> 1) Is your response encoded in some encoding already e.g. in UTF-8?
> In UAT-8 this é sign would be the bytes "c3 a9".
> Am I getting the two bytes "c3 a9" or just the single byte "e9"?
>
> 2) is your response XML-escaped meaning would I get
> (a) Query="curtains curtains blinds &amp; shades home d&#233;cor home"
> or
> (b) Query="curtains curtains blinds &amp; shades home décor home"
> in my XML even if we assume your response is UTF-8 encoded?
>
> Seems either I am doing something wrong or there's invalid data in the
> returned response.
>
> Regards,
> Peter
>
>
>
>
>
>
>

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://adwordsapi.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en

Reply via email to