Open sckott opened 5 years ago
I think best approach is to take the string from the cassette and replace any non ascii strings with unicode equivalent, or if none found, then drop the non-ascii, or something else? ideally would use stringi
, but the pkg is so heavy so not sure want to import it. but could have as a Suggest and if not installed, then do something with base R. I like the idea of a filter before loading into yaml because then we don't touch the real request/response
probably happen on the line after this or so https://github.com/ropensci/vcr/blob/master/R/serializers-yaml.R#L76
maybe:
text_cleaner <- function(x) {
if (requireNamespace("stringi")) {
stringi::stri_escape_unicode(x)
} else {
# some other w/o stringi
}
}
another reason to get that JSON serializer done sooner than later, it may help avoid these yaml pkg problems
another reason to get that JSON serializer done sooner than later, it may help avoid these yaml pkg problems
It seems so at least for my encoding problems. :-D
right. it'd be nice to have a better yaml pkg, but its easier here to just recommend people use json if they have any issue
Arose from recent realization that strings in cassettes, any string in the cassette (not just the response body), that are not UTF-8 can cause problems on some platforms, e.g.,
tools::showNonASCIIfile("tests/fixtures/cr_citation_count.yml")
tools::showNonASCIIfile("tests/fixtures/cr_cn_different_base_urls.yml")
tools::showNonASCIIfile("tests/fixtures//bison.yml")
tools::showNonASCIIfile("tests/fixtures/vcr_cassettes/dc_search_csv.yml")
Options:
skip_vcr_non_utf8()