Page 1 of 1

Use of Arabic text in PDA data entry application

Posted: March 5th, 2012, 4:03 pm
by ibjelic
We are currently working on developing PDA data entry application in Arabic, and we have encountered several difficulties with display of Arabic text. One pending issue that would need resolving is display of alphanumeric characters when passed as reference variables in the question text. For example if variable “name” is defined as Alpha, and then passed to the CAPI question (%name%) it is displayed as meaningless characters in question text, while in the saved file it has a correct appearance in Arabic.

It would be terrific if someone has solution for this problem.

Second question, is it by any chance possible to increase font size of response categories in CAPI application?

Many thanks in advance,

Ivana

Re: Use of Arabic text in PDA data entry application

Posted: March 6th, 2012, 9:40 am
by Gregory Martin
Ivana,

This illustrates a reason why the next version of CSPro will have Unicode support. Working with non-Latin languages in CSPro can be tricky and annoying. There is a way to do what you want, however. It requires parsing your Arabic string and converting any Arabic character to its Unicode equivalent and then using that constructed string in your CAPI question. For example, if instead of using %name% you use %capiName% instead, the following code will work for you. You can reuse the arabicAnsiToUnicode function whenever necessary. I wrote this code with the help of the Arabic encoding chart on this page: http://www.ldc.upenn.edu/myl/morph/buckwalter.html
PROC GLOBAL

alpha (45) ansiCodes = "ÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßáãäåæìíðñòóõöøú";

array unicodeCodes(45) =    1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583,1584,1585,1586,
                            
1587,1588,1589,1590,1591,1592,1593,1594,1600,1601,1602,1603,1604,1605,1606,1607,1608,1609,
                            
1610,1611,1612,1613,1614,1615,1616,1617,1618;


alpha (500) capiName,tempStr;

function alpha (500) arabicAnsiToUnicode(alpha (200) str)

    
numeric i,newStrI = 1;
    
numeric strLength = length(strip(str));

    
do i = 1 while i <= strLength
    
        
numeric indexPos = pos(str[i:1],ansiCodes);
    
        
if indexPos then
            tempStr[newStrI] =
maketext("\u%d?",unicodeCodes(indexPos));
            
inc(newStrI,7);
        
        
else
            tempStr[newStrI] = str[i:
1];
            
inc(newStrI);

        
endif;
    
    
enddo;
    
    arabicAnsiToUnicode = tempStr;

end;



// ...


PROC NAME

    capiName = arabicAnsiToUnicode(NAME);

Re: Use of Arabic text in PDA data entry application

Posted: March 6th, 2012, 1:28 pm
by ibjelic
Thank you so much. This is very helpful.
I was also wondering if there is anything that we can do in order to increase font size of response categories on WVGA devices? We got a feedback from the field that font size is too small. It would be terrific if it would be possible to increase it.
Thanks. Ivana

Re: Use of Arabic text in PDA data entry application

Posted: March 15th, 2012, 2:21 pm
by Gregory Martin
I do not believe that there is a way to increase the font size, but I'm not sure because I haven't used the PDA version on WVGA devices. The CSPro function setfont only works on the desktop version of the software package.

Maybe someone with more experience with the PDA version can provide some advice. Can you change the resolution on your PDA somehow?