Topic: Writing Arabic in Fields with English User

When logged in as a User with Language as English, Writing Arabic in Fields like Customer Name shows ?????????
While being logged in as a User with language as Arabic accepts it.

Even any customer name added in Arabic as an Arabic User shows as ??????? when logged in as English User.

How can we use Arabic to input some fields while Logged in as Arabic User?

www.boxygen.pk

2 (edited by rafat 05/16/2019 11:41:28 am)

Re: Writing Arabic in Fields with English User

boxygen,
this wiki
contains the guidelines for you to achieve what you want.

Basically you need to change the encoding to utf-8 of the English language.
Heres what ../lang/installed_languages.inc looks like in my case and it works OK for me.

$installed_languages = array (
  0 => 
  array (
    'code' => 'C',
    'name' => 'English',
    'encoding' => 'utf-8',
  ),
  1 => 
  array (
    'name' => 'Arabic',
    'package' => 'ar_EG',
    'code' => 'ar_EG',
    'encoding' => 'utf-8',
    'version' => '2.4.1-3',
    'path' => 'lang/ar_EG',
    'rtl' => true,
  ),
);

$dflt_lang = 'C';

Re: Writing Arabic in Fields with English User

Great @rafat that worked for me thanks.

www.boxygen.pk

Re: Writing Arabic in Fields with English User

@joe- it's better we can add this change to core. People can write any language in input field

Subscription service based on FA
HRM CRM POS batch Themes

Re: Writing Arabic in Fields with English User

Hi,
One thing about choosing UTF-8 that works OK with many languages is the PDF files generated when one chooses to use it. An invoice PDF file is 200KB when iso-8859-1 is specified and its 700KB if UTF-8 is used.

Now I have tried to use iso-8859-6 (Arabic) instead but always got a not supported error in the error log although my system locale has iso-8859-6 installed.

Re: Writing Arabic in Fields with English User

Hi,

I found the below in /includes/sessions.inc around line 333

/*
    htmlspecialchars does not support certain encodings.
    ISO-8859-2 fortunately has the same special characters positions as 
    ISO-8859-1, so fix is easy. If any other unsupported encoding is used,
    add workaround here.
*/
function html_specials_encode($str)
{
    return htmlspecialchars($str, ENT_QUOTES, $_SESSION['language']->encoding=='iso-8859-2' ?
         'ISO-8859-1' : $_SESSION['language']->encoding);

I replaced iso-8859-2 with iso-8859-6 and now Arabic works OK.

I dont know if this is a workaround or it might have some other consequences..It seems OK to me.