Search code examples
htmlencodingarabic

What is the encoding scheme for this Arabic web page?


I am trying to find the encoding scheme for this page (and others) which are surely Arabic, using lower ASCII range Latin characters to encode the contents.

http://www.saintcyrille.com/2011a.htm

http://www.saintcyrille.com/2011b.htm (English version/translation of that same page)

I have seen several sites and even PDF documents with this encoding, but I can't find the name or method of it.

This specific page is from 2011 and I think this is a pre-Unicode method of encoding Arabic that has fallen out of fashion.

Some sample text:

'D1J'6) 'D1H-J) 'DA5-J)
*#ED'* AJ 3A1 'D*CHJF
JDBJG'
'D#( / 3'EJ -D'B 'DJ3H9J 
'D0J J#*J .5J5'K EF -D( @ 3H1J' 

Solution

  • An extraordinary mojibake case. It looks like there is missing high byte in Unicode code points in Arabic text. For instance: ا (U+0627, Arabic Letter Alef) appears as ' (U+0027, Apostrophe).

    Let's suppose that missing high byte is always 0x06 in the following PowerShell script (added some more strings from the very end of the page http://www.saintcyrille.com/2011a.htm to your sample text):

    $mojibakes = @'
    E3'!K
    'D1J'6) 'D1H-J) 'DA5-J)
    *#ED'* AJ 3A1 'D*CHJF
    JDBJG'
    'D#( / 3'EJ -D'B 'DJ3H9J 
    'D0J J#*J .5J5'K EF -D( @ 3H1J'
    ED'-8'* :
    'D#CD 'D5J'EJ 7H'D 'D#3(H9 'D98JE E-(0 ,/'K H'D5HE JF*GJ (9/ B/'3 'D9J/
    J-(0 'D*B/E DD'9*1'A (9J/'K 9F JHE 'D9J/ (B/1 'D%EC'F -*I *3*7J9H' 'DE4'1C) AJ 'D5DH'* HB/'3 'D9J/  HFF5- D0DC  'D'3*A'/) EF -AD) 'D*H() 'D,E'9J) JHE 'D,E9) 15 '(1JD 2011 -J+ JGJ# 'D,EJ9 E9'K DFH'D 31 'DE5'D-) ( 9// EF 'D#('! 'DCGF) 3JCHF -'61'K )
    (5F/HB 'D5HE) 9F/ E/.D 'DCFJ3) AAJ A*1) 'D#9J'/ *8G1 AJF' #9E'D 'D1-E) H'D5/B'* HE' JB'(DG' H0DC 9ED EB(HD HEE/H-
    HDF' H7J/ 'D#ED #F *4'1CH' 'D'-*A'D'* AJ 19J*CE HCD 9'E H#F*E (.J1
    'DE3J- B@'E ... -@B'K B@'E
    '@ -split [System.Environment]::NewLine
    
    Function highByte ([byte]$lowByte, [switch]$moreInfo) {
        if ( $moreInfo.IsPresent -and (
                $lowByte -lt 0x20 -or $lowByte -gt 0x7f )) {
            Write-Host $lowByte -ForegroundColor Cyan 
        }
        if ( $lowByte -eq 0x20 ) { 0,$lowByte } else { 6,$lowByte }
    }
    
    foreach ( $mojibake in $mojibakes ) {
        $aux = [System.Text.Encoding]::
            GetEncoding( 1252).GetBytes( [char[]]$mojibake )
        [System.Text.Encoding]::BigEndianUnicode.GetString(
            $aux.ForEach({(highByte -lowByte $_)})
        )
        '' # new line separator for better readability
    }
    

    Output (using Google Translate) seems to give a sense roughly similar to English version of the page, after a fashion…

    Output: .\SO\70062779.ps1

    مساءً

    الرياضة الروحية الفصحية

    تأملات في سفر التكوين

    يلقيها

    الأب د سامي حلاق اليسوعي

    الذي يأتي خصيصاً من حلب ـ سوريا

    ملاحظات غ

    الأكل الصيامي طوال الأسبوع العظيم محبذ جداً والصوم ينتهي بعد قداس العيد

    يحبذ التقدم للاعتراف بعيداً عن يوم العيد بقدر الإمكان حتى تستطيعوا المشاركة في الصلوات وقداس العيد ، وننصح لذلك ، الاستفادة من حفلة التوبة الجماعية يوم الجمعة رص ابريل زذرر حيث يهيأ الجميع معاً لنوال سر المصالحة ب عدد من الأباء الكهنة سيكون حاضراً ة

    بصندوق الصومة عند مدخل الكنيسة ففي فترة الأعياد تظهر فينا أعمال الرحمة والصدقات وما يقابلها وذلك عمل مقبول وممدوح

    ولنا وطيد الأمل أن تشاركوا الاحتفالات في رعيتكم وكل عام وأنتم بخير

    المسيح قـام خخخ حـقاً قـام

    Please keep in mind that I do not understand Arabic.

    • The script does not handle numbers: year 2011 in note #2 is incorrectly transformed to زذرر, for instance;
    • Handling spaces is unclear: is 0x20 always a space, or should be transformed to ؠ (U+0620, Arabic Letter Kashmiri Yeh)?
    • moreover, there is that problematic presumption about Unicode range U+0600-U+067F (where are U+0680-U+06FF and others?).