title: Error : Invalid multibyte character in parser at line~
body: <p>I have a that working well in R ver 3.6.3.</p>
  
  <p>And 1 Weeks ago I download R ver 4.0.0 because I replace my old computer with new one.</p>
  
  <p>Then Suddenly my all code work very poor in R 4.0.0!</p>
  
  <p>When I first search this error, most of people recommend some ways that is related to UTF-8</p>
  
  <p>But What is very annoying is I'm already set my environment! Using Global option tap or else..</p>
  
  <p>I tried to almost everything which is related UTF-8, but It never works.</p>
  
  <p>Also, I tried to update packages tool already but again it never works.</p>
  
  <p>Then Sometimes, I found somethings very strange by chance.</p>
  
  <p>That is, </p>
  
  <ol>
  <li>when I randomly push 'enter' key, suddenly the error didn't pop up!</li>
  </ol>
  
  <p>But I can't find the exact reason why this was happened.</p>
  
  <ol start="2">
  <li><p>when I paste this code in R ver 3.6.3, It works very nicely! WHAT IS THE REASON!!!</p></li>
  <li><p>This is same code but, when I tried to execute this code just changing the blank (I mean \r\n(?) \n(?) anyway..) Sometimes the code didn't work, Other times the code works.</p></li>
  </ol>
  
  <p>This makes me crazy now I don't know the reason
  Please help me</p>
  
  <p>The code below is the code what I mentioned until now.</p>
  
  <p>And I attached the picture that is the outcome in R ver 4.0.0</p>
  
  <p>Thank you for reading.</p>
  
  <pre><code>Jeokhap &lt;- function(target_pdf){
  
    target &lt;- target_pdf
  
    page_jeok_1 &lt;- grep("(4.{0,3}|라.{0,3})\\s{0,}이 (집합투자..|투자신탁)에 적합한 투자자 유형",target)
  
    for (k in 1:(length(target)-page_jeok_1)){
  
      if(length(grep("11.{0,3}매입,\\s{0,1}환매",target[(page_jeok_1+k)]))&gt;0){
  
          page_jeok_2 &lt;- page_jeok_1+k
  
          break
      }
  
    }
  
    app_list_jeok=c()
  
    for (k in page_jeok_2:page_jeok_1){
  
      app_list_jeok &lt;- append(target[k],app_list_jeok)
  
    }
  
    outcome_jeok &lt;- paste(app_list_jeok,collapse="")
  
  
    ####extract sentence
    check_jeok &lt;- gregexpr("(4.{0,3}|라.{0,3})\\s{0,}이 (집합투자..|투자신탁)에 적합한 투자자 유형(.*?)11.{0,3}s{0,1}매입,\\s{0,1}환매",outcome_jeok)
    sentence_choose_jeok3 &lt;- regmatches(outcome_jeok,check_jeok)
  
    if(length(regexpr("위험\\s{0,}\\등급\\s{0,}분류\\s{0,}기준",sentence_choose_jeok3))==1){
  
      sentence_choose_jeok3 &lt;- gsub("위험\\s{0,}\\등급\\s{0,}분류\\s{0,}기준.*","",sentence_choose_jeok3)
    }else if(length(regexpr("위험\\s{0,}\\등급\\s{0,}분류\\s{0,}기준",sentence_choose_jeok3))&gt;1){
  
      sentence_choose_jeok3 &lt;- sub("(위험\\s{0,}\\등급\\s{0,})(분류\\s{0,})(기준)","\\1\\2의 기준",sentence_choose_jeok3)
  
      sentence_choose_jeok3 &lt;- gsub("위험\\s{0,}\\등급\\s{0,}분류\\s{0,}기준.*","",sentence_choose_jeok3)
    }
  
  
    if(length(regexpr("투자\\s{0,}\\위험\\s{0,}등급\\s{0,}기준",sentence_choose_jeok3))==1){
  
      sth1 &lt;- gsub("투자\\s{0,}\\위험\\s{0,}등급\\s{0,}기준.*","",sentence_choose_jeok3)
    }else if(length(regexpr("투자\\s{0,}\\위험\\s{0,}등급\\s{0,}기준",sentence_choose_jeok3))&gt;1){
  
      sentence_choose_jeok3 &lt;- sub("(투자\\s{0,}\\위험\\s{0,})(등급\\s{0,})(기준)","\\1\\2의 기준",sentence_choose_jeok3)
  
      sentence_choose_jeok3 &lt;- gsub("투자\\s{0,}\\위험\\s{0,}등급\\s{0,}기준.*","",sentence_choose_jeok3)
    }
  
  
    return(1)
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/nHM7z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nHM7z.png" alt="Executed code in R 4.0.0"></a></p>