title: R string, UTF-8 coding swedish character treatment
body: <p>have problem to change the swedish characters ä ö å in a presentable way in R<br>
  I got my data directly from MS SQL database<br>
  here are the examples</p>
  
  <pre><code>markets &lt;- c("Caf\xe9                          ","Restaurang kv\xe4ll              ","Barnomsorg tillagningsk\xf6k     ","Folkh\xf6gskola                  ")
  </code></pre>
  
  <p>then I use gusb to remove the lefthand space</p>
  
  <pre><code>market=gsub(" ", "", markets,fixed = TRUE)
  </code></pre>
  
  <p>I got this error:<br>
  Error in gsub(" ", "", market, fixed = TRUE) :<br>
    input string 3 is invalid UTF-8</p>
  
  <p>then I use this command:<br>
     markets_new=gsub(" ", "", markets)</p>
  
  <p>then have strange Chinese characters in the string,
  "Caf攼㸹"
  "Restauranglunch+kv攼㸴ll"
  "Barnomsorgtillagningsk昼㸶k"
  "Folkh昼㸶gskola"</p>
  
  <p>I tried the treatment change the default setting of Rstudio by following:
  <a href="https://yihui.name/en/2018/11/biggest-regret-knitr/?fbclid=IwAR2E5Lp0zjS51fcdjgZ1tej0sg5EBxfG8sNitt-cUA2XEshnT3lNCHNQ3Do" rel="nofollow noreferrer">https://yihui.name/en/2018/11/biggest-regret-knitr/?fbclid=IwAR2E5Lp0zjS51fcdjgZ1tej0sg5EBxfG8sNitt-cUA2XEshnT3lNCHNQ3Do</a></p>
  
  <p>it does not help, was also try to use gsub() substitute the characters but seems not working. </p>
  
  <p>One more thing, if I use </p>
  
  <pre><code>write.csv(markets,'submarket product view.csv',row.names = F)
  </code></pre>
  
  <p>then in my csv file what I see as follows</p>
  
  <pre><code>"Caf&lt;e9&gt;                          "
  "Restaurang kv&lt;e4&gt;ll              "
  "Barnomsorg tillagningsk&lt;f6&gt;k     "
  "Folkh&lt;f6&gt;gskola                  "
  "Sm&lt;f6&gt;rg&lt;e5&gt;s/salladsrestaurang     " 
  </code></pre>
  
  <p>I think <code>&lt;e9&gt;</code> is e with a hat, <code>&lt;e4&gt;</code> is ä, <code>&lt;f6&gt;</code> is ö, and <code>&lt;e5&gt;</code> is å<br>
  Any treatment suggestion? </p>