## ----include = FALSE---------------------------------------------------------- knitr::opts_chunk$set(collapse = TRUE, comment = "#>") ## ----------------------------------------------------------------------------- library(zuhtml) ## ----------------------------------------------------------------------------- html_limits() ## ----------------------------------------------------------------------------- err <- tryCatch( html_parse(strrep("
Small page
", limits = strict) ## ----------------------------------------------------------------------------- bytes <- as.raw(c(0x3c, 0x70, 0x3e, 0x63, 0x61, 0x66, 0xe9)) # "caf\xe9" html_text_clean(html_parse(bytes, encoding = "latin1")) ## ----------------------------------------------------------------------------- try(html_parse(bytes)) ## ----------------------------------------------------------------------------- page <- c(charToRaw("
"), as.raw(0x93), charToRaw("Quoted"), as.raw(0x94)) doc <- html_parse(page) html_text_clean(doc) html_info(doc)[c("encoding", "encoding_source")] ## ----------------------------------------------------------------------------- tryCatch( html_elements(html_parse("
"), "p:hover"), zuhtml_selector_error = function(e) paste("unsupported at", e$position) ) .