Trouble Displaying Arabic Characters When Running R

Hi everybody, I'm using R to create an edge list based on Vensim models. The R code itself works fine but it does not seem to register different languages. The work I'm doing involves Arabic characters, so when my R code runs, it fails to display these Arabic characters correctly.

Here's an example screenshot of what happens when I run the R code on my computer:

However, when a colleague runs the same R code on her computer, the output .xlsx file displays correctly for her and it displays correctly on my computer when she sends the file over.

We are using identical codes, so I'm not sure if the issue is outside R entirely or if it has to do with something related to R. I am using RStudio version 1.4.1106 on a PC. I should also add that I am a complete novice when it comes to R and am using a code a different colleague developed. Are there any ideas on what I need to do to resolve this issue? Any help would be greatly appreciated.

This is likely due to operating system settings for language encoding. Default settings differ for Windows and the Unix-derived OS and can be overridden. Your colleague is probably set for what is called UTF-8 encoding, which can display Arabic characters.

ipsum_loren <- "لكن لا بد أن أوضح لك أن كل هذه الأفكار المغلوطة حول استنكار  النشوة وتمجيد الألم نشأت بالفعل، وسأعرض لك التفاصيل لتكتشف حقيقة وأساس تلك السعادة البشرية، فلا أحد يرفض أو يكره أو يتجنب الشعور بالسعادة، ولكن بفضل هؤلاء الأشخاص الذين لا يدركون بأن السعادة لا بد أن نستشعرها بصورة أكثر عقلانية ومنطقية فيعرضهم هذا لمواجهة الظروف الأليمة، وأكرر بأنه لا يوجد من يرغب في الحب ونيل المنال ويتلذذ بالآلام، الألم هو الألم ولكن نتيجة لظروف ما قد تكمن السعاده فيما نتحمله من كد وأسي"

ipsum_loren
#> [1] "لكن لا بد أن أوضح لك أن كل هذه الأفكار المغلوطة حول استنكار  النشوة وتمجيد الألم نشأت بالفعل، وسأعرض لك التفاصيل لتكتشف حقيقة وأساس تلك السعادة البشرية، فلا أحد يرفض أو يكره أو يتجنب الشعور بالسعادة، ولكن بفضل هؤلاء الأشخاص الذين لا يدركون بأن السعادة لا بد أن نستشعرها بصورة أكثر عقلانية ومنطقية فيعرضهم هذا لمواجهة الظروف الأليمة، وأكرر بأنه لا يوجد من يرغب في الحب ونيل المنال ويتلذذ بالآلام، الألم هو الألم ولكن نتيجة لظروف ما قد تكمن السعاده فيما نتحمله من كد وأسي"

(This is under Ubuntu.) If you are on Windows, perhaps another member can help you. I haven't used it since the first Clinton administration.

Hi thank you so much for responding. I checked and reran the code with UTF-8 encoding, but I still ran into the same issue. I am on Windows, which could explain why it's strange, but I appreciate all the help!

One thing to check: can Office applications display correctly?

They display correctly when I'm using the languages in the beginning. But when I'm exporting an edgelist from R into Office applications, that's when the issue arises. I'm not sure if I need to do something with the Office applications to get the exporting to work, but the languages are all installed and I can use them on Office.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.