2

Is there a way to change the character encoding system in R according to the Turkish language?

I tried to change the encoding while saving an R Script to iso-8859-9, windows-1254 or to latin5. The last encoding gave me the best results, however when I reload the R Script not all of the characters were saved properly. For example:

Original:

hâkimiyetinin
çıkıyor

Reloading (characters in the second example chrashed):

hâkimiyetinin
çýkýyor

Anyone an idea? Thank you in advance!

OAM
  • 179
  • 1
  • 14

2 Answers2

5

I had a similar problem, I tried several things including Israel's answer but the only thing that helped me was changing the locale.

I just typed the following command into the RStudio console.

Sys.setlocale(category = "LC_ALL", locale = "Turkish")

Now whenever I type İstanbul I get the dot on the I. Before I had it set to UTF-8 but it would still cause problems.

I found this question about Greek characters but it's essentially the same principle. Just change "Greek" to "Turkish".

YvdW
  • 106
  • 2
  • 10
0

This function should tell you which encodes are in your machine

iconvlist()

This should tell you in which encode is the string pal

Encoding(pal)

This should change the encode for pal

 Encoding(pal) <- "latin1"

This should translate pal to a certain encode

pal <- iconv(pal, to='ASCII//TRANSLIT')

and I don't know if this encodes are the ones you are looking for

"x-mac-turkish" or "macturkish"  

hope this helps

Israel Rodriguez
  • 425
  • 1
  • 6
  • 24