1library(RCurl) 2Sys.setlocale(, "en_US.UTF-8") 3x = getURL("http://www.omegahat.net/RCurl/index.html") 4Encoding(x) 5 6f = system.file("NAMESPACE", package = "RCurl") 7x = postForm("http://eeyore.ucdavis.edu/cgi-bin/testForm1.pl", "fileData" = fileUpload(f), .opts = list(header =TRUE)) 8x = postForm("http://eeyore.ucdavis.edu/cgi-bin/testForm1.pl", "fileData" = fileUpload(f)) 9x = postForm("http://eeyore.ucdavis.edu/cgi-bin/testForm1.pl", "fileData" = fileUpload(f), 10 .opts = list(writefunction = function(x) {browser(); nchar(x)})) 11 12# This determines the encoding from the HTTP header of the response 13x = getURL("http://www.cl.cam.ac.uk/%7Emgk25/ucs/examples/UTF-8-demo.txt", 14 header = TRUE, 15 write = function(x) {print(Encoding(x)) 16 # print(nchar(x)) # this causes problems about invalid multibyte string. Why? Are we on a boundary 17 # i.e. the chunks come 18 nchar(x, "bytes")}) 19