File: encoding.R

package info (click to toggle)
r-cran-rcurl 1.95-4.8-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 4,140 kB
  • ctags: 515
  • sloc: ansic: 3,135; xml: 1,734; asm: 993; sh: 12; makefile: 2
file content (29 lines) | stat: -rw-r--r-- 486 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
library(XML)
xmlParse("<doc/>", asText = TRUE)

myParse =
  function(x)
     parse(text = x)

foo =
function(x) {
 browser()
 iconv(x, "", "UTF8")
}

foo =
function(x) {
 tt = readLines(file(x, encoding = "UTF8"))
 browser()
 tt
}


library(RCurl)
url <- "http://search.twitter.com/search.json?q=%E5%95%A4%E9%85%92&result_type=recent&rpp=1&page=1"
doc <- getURLContent(URLencode(url), .encoding = "UTF-8")
Encoding(doc)

library(RJSONIO)
j <- fromJSON(doc)
tweet <- j$results[[1]]$text