I guess you can ignore this one. I figured it out. I believe the answers are:
1) Your data is UTF-8 encoded. 2) You don't escape these as you did (like é) but that's still OK. Regards, Peter On Mon, Oct 31, 2011 at 12:31 PM, Peter Petrov <[email protected]> wrote: > 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 <[email protected]>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 & shades home décor home" >> >> This é 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 & shades home décor home" >> or >> (b) Query="curtains curtains blinds & 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en
