I have been trying to read and output a Hindi .txt file into the R console but I get gibberish. This is what I did so far.
hindi <- read.table('hindi_text.txt')
hindi
1 कà¥à¤¯à¤¾ बोल रहे हो तà¥à¤®
Then I typed this. It still does not work.
> Sys.setlocale(category="LC_ALL", locale="hindi")
> [1] "LC_COLLATE=Hindi_India.1252;LC_CTYPE=Hindi_India.1252;LC_MONETARY=Hindi_India.1252;LC_NUMERIC=C;LC_TIME=Hindi_India.1252"
> hindi
> 1 कà¥à¤¯à¤¾ बोल रहे हो तà¥à¤®
I tried this with reading Chinese characters by changing the locale to Chinese and it worked.
> chinese <- read.table("chinese.txt")
> Sys.setlocale(category="LC_ALL", locale="chinese")
> [1] "LC_COLLATE=Chinese (Simplified)_China.936;LC_CTYPE=Chinese (Simplified)_China.936;LC_MONETARY=Chinese (Simplified)_China.936;LC_NUMERIC=C;LC_TIME=Chinese (Simplified)_China.936"
> chinese
> 1 锘夸负浠€涔堣繖涓敞鎰忥紝杩欎釜宸ヤ綔
Why does this work with Chinese and not Hindi (and some other languages too) and is there any way I can make it work?