jburkhardt / RAdwords

Loading Google Adwords Data into R
https://github.com/banboo-data/r4googleads
Other
99 stars 36 forks source link

Error with accentuation when retrieving data #109

Closed diegocgaona closed 5 years ago

diegocgaona commented 5 years ago

Hi!

I having a problem with my data, which contain latin characters with accentuation. When I get the data from Radwords, which should be "Matérias" come as "Matérias". It occurs with all the other accentuated strings. Until 2 or 3 months ago, it came right, but now, I always get it wrong.

I'm using getData like this:

adw_adg_full_summ <- getData(clientCustomerId = adw_id, google_auth = adw_auth, statement = adw_stat_adg,
                             includeZeroImpressions = T)

Even when I use transformation = FALSE the problem persist.

I changed the locale, (to Portuguese_Brazil.1252) but without success.

Is a Adwords API problem? You know a way to get it right?

Many thanks in advance, Diego.

diegocgaona commented 5 years ago

I think I found the problem, in the statement, I need to disable the gzip compression using compress = FALSE. With this, the codification is fine.

Is something you can solve in the package or is with Google?

Thanks!!

rachelbarbara commented 5 years ago

I've been having the same issue with german characters on code that used to return them fine. Thanks for the compress = FALSE tip!

jburkhardt commented 5 years ago

Hi @diegocgaona, thank you for using the package and raising this issue. @rachelbarbara thank you for the feedback as well. I cannot reproduce the error. It seems that there is an issue with character encoding on your system.

Could you please provide the following information?

We did not change anything with RAdwords or the Adwords API lately. I guess the issue is related to an update of your system.

diegocgaona commented 5 years ago

Hi,

I'm using Windows 10 (updated) in english with R version 3.5.1 (2018-07-02) and RAdwords_0.1.18 (more details bellow).

But, as I told above, the solution is use compress = FALSE in the statement and it worked fine.

My currently (working fine) statement is:

adw_stat_adg <- statement(select = adw_metrics,
                          report = "ADGROUP_PERFORMANCE_REPORT",
                          where = "Labels CONTAINS_ANY [2050451186]",
                          start= adw_s_date,
                          end= adw_e_date,
                          compress = FALSE)

The only change from before is the compress = FALSE. I don't know if the compress (and the character error) occur on Google side or R side.

R.version
               _                           
platform       x86_64-w64-mingw32          
arch           x86_64                      
os             mingw32                     
system         x86_64, mingw32             
status                                     
major          3                           
minor          5.1                         
year           2018                        
month          07                          
day            02                          
svn rev        74947                       
language       R                           
version.string R version 3.5.1 (2018-07-02)
nickname       Feather Spray          
R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] RAdwords_0.1.18      RevoUtils_11.0.1     RevoUtilsMath_11.0.0

loaded via a namespace (and not attached):
 [1] htmlwidgets_1.3 httr_1.4.0      compiler_3.5.1  rjson_0.2.20    R6_2.2.2        magrittr_1.5    htmltools_0.3.6 tools_3.5.1     RCurl_1.95-4.11 yaml_2.2.0     
[11] Rcpp_1.0.0      DT_0.5          digest_0.6.15   bitops_1.0-6

Many thanks, Diego.

jburkhardt commented 5 years ago

Hi @diegocgaona

Thank you for your help!

If you set compress=TRUE, the data are downloaded as a zip file and unpacked on your system. R reads the unzipped data from your system and the encoding of your system might alter the data.

I cannot reproduce your issue since I have a different system, however I tried to fix the issue. Could you please install RAdwords with the following code and test if the characters are fine when you run your code with compress=T again?

require(devtools)
install_github('jburkhardt/RAdwords', ref = "compress_encoding")

I am looking forward to your answer!

diegocgaona commented 5 years ago

Hi @jburkhardt

Many thanks! I have installed the package as you said and changed back the compress to TRUE, and now it seems fine, the accentuation is correct.

Many thanks!!