title: How to encode a character string in multiple languages in R?
body: <p>I am having issues with how R is handling characters in different languages. I have a multilanguage data set (PL, HR, EN, FR, GE, IT) and I created a keyword string to filter this. However, R is not recognizing all of my characters in every language but converts them which is problematic.</p>
  <p>So imagine I would like to look for the word &quot;łapać&quot; in my data by using the string then R would filter for &quot;lapac&quot; and thus wouldn't find the necessary word, because in the database it has properly read the original word:</p>
  <pre><code>catch &lt;- &quot;łapać&quot;
  catch
  [1] &quot;lapac&quot;
  </code></pre>
  <p>I tried out different things and for some characters/languages it is working. For example:</p>
  <pre><code>things &lt;- &quot;ćłßöüžỳđčšśęıчуй&quot;
  things
  [1] &quot;clßöüžỳdcšseiчуй&quot;
  </code></pre>
  <p>As you see, some characters are displayed as they should be (ö,ü,ž and even the cyrillic ones like ч or й) others are converted (ćł to cl).</p>
  <p>I tried reopening the document with different encoding and changing the encoding:</p>
  <pre><code>options(encoding = &quot;utf-8&quot;)
  
  Encoding(things) &lt;- &quot;UTF-8&quot;
  </code></pre>
  <p>Also, I tried it with differen R versions on two different Windows computers.</p>
  <pre><code>R version 4.1.2 (2021-11-01)
  Platform: x86_64-w64-mingw32/x64 (64-bit) 
  Running under: Windows 10 x64 (build 17763)
  locale:
  [1] LC_COLLATE=German_Germany.1250  LC_CTYPE=German_Germany.1250   
  [3] LC_MONETARY=German_Germany.1250 LC_NUMERIC=C                   
  [5] LC_TIME=German_Germany.1250
  </code></pre>