title: Invalid input error in utf8towcs when running R code in shiny
body: <p>When I run the app, I getting the following error.</p>
  
  <pre><code>Error in FUN: invalid input 'at my monthly blog stats and weâ€™re nearly on 4000 for April which is amazing â€“ thank you Jx ðŸ˜˜ðŸ˜˜' in 'utf8towcs'
  </code></pre>
  
  <p>I tried to covert the data as below because of emotions etc in blogs.txt file.</p>
  
  <pre><code>blogs&lt;-iconv(blogs, "latin1", "ASCII", sub="")
  
  news&lt;-iconv(news, "latin1", "ASCII", sub="")
  
  twitter&lt;-iconv(twitter, "latin1", "ASCII", sub="")
  </code></pre>
  
  <p>and also using icon function as below,</p>
  
  <h1>Create corpus and clean the data</h1>
  
  <pre><code>corpus &lt;- VCorpus(VectorSource(data.sample))
  
  toSpace &lt;- content_transformer(function(x, pattern) gsub(pattern, " ", x))
  
  corpus &lt;- tm_map(corpus, toSpace, "(f|ht)tp(s?)://(.*)[.][a-z]+")
  
  tospace &lt;- tm_map(corpus,
  
  content_transformer(function(x)
  
  iconv(x, to="UTF-8", sub="byte")),
  
  mc.cores=1)
  </code></pre>
  
  <p>Still, I am getting the issue.</p>
  
  <p>Please help in this regard.</p>
  
  <p>Session info:</p>
  
  <p>====================</p>
  
  <p>R version 3.4.2 (2017-09-28)</p>
  
  <p>Platform: x86_64-w64-mingw32/x64 (64-bit)</p>
  
  <p>Running under: Windows 7 x64 (build 7601) Service Pack 1</p>
  
  <p>Matrix products: default</p>
  
  <p>locale:</p>
  
  <p>[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252</p>
  
  <p>[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C</p>
  
  <p>[5] LC_TIME=English_United States.1252</p>
  
  <p>attached base packages:</p>
  
  <p>[1] stats graphics grDevices utils datasets methods base</p>
  
  <p>other attached packages:</p>
  
  <p>[1] stringr_1.2.0 shiny_1.0.5 slam_0.1-40 ggplot2_2.2.1 RWeka_0.4-35 tm_0.7-1 NLP_0.1-11</p>
  
  <p>[8] stringi_1.1.5</p>
  
  <p>loaded via a namespace (and not attached):</p>
  
  <p>[1] Rcpp_0.12.13 magrittr_1.5 RWekajars_3.9.1-4 munsell_0.4.3 colorspace_1.3-2</p>
  
  <p>[6] xtable_1.8-2 R6_2.2.2 rlang_0.1.4 plyr_1.8.4 tools_3.4.2</p>
  
  <p>[11] parallel_3.4.2 grid_3.4.2 gtable_0.2.0 htmltools_0.3.6 yaml_2.1.14</p>
  
  <p>[16] lazyeval_0.2.1 digest_0.6.12 tibble_1.3.4 rJava_0.9-9 rsconnect_0.8.5</p>
  
  <p>[21] mime_0.5 compiler_3.4.2 scales_0.5.0 jsonlite_1.5 httpuv_1.3.5</p>