aseela
22nd January 2013, 12:33
Dear Expert,

I have linked Baan to external executable using run.prog() to decode a given amount of money from numbers format to Arabic words in order to print some Arabic reports. The executable output a text file with a single line of Arabic string. Then I open the file, read the content and close it using seq.open, seq.gets and seq.close. I was successfully able to get the results into the reports, however, seq.gets() returns unrecognized characters. I've tried mb.import$(), uni.import() with no luck to convert the string out of seq.gets() variable.


extern domain tcmcs.long ret1, ret2, ret3, ret4, ret5
extern domain tcmcs.str100 comm
extern domain tcmcs.str6 amnt
extern domain tcmcs.str80m arabic_decode1, arabic_decode2

amnt = str$(amount)
comm = "e:\arabicdecode\arabicdecode.exe " & amnt
ret1 = run.prog("cmd.exe", "cmd /c " & comm, RP_WAIT)
if ret1 = 0 then
ret2 = seq.open("e:\arabicdecode\converted.txt","r")
ret3 = seq.gets(arabic_decode1, 80 ,ret2, GETS_NORMAL, ret4)
ret5 = seq.close(ret2)
endif


So, how to read this unicode text file with its Arabic characters?


Hint - Our environment installation has Arabic locale already, the database accept Arabic and we have some running Arabic reports.

Attached is a snapshot of the debugger with the garbage string.

Thank you

aseela
22nd January 2013, 13:36
Thank you guys for the rich content of this forum. It helps me solve a lot of issues I'm facing. Regarding this issue, it is solved using utf8.import(). like this:

ret2 = seq.open("e:\arabicdecode\converted.txt","r")
ret3 = seq.gets(arabic_decode1, 80 ,ret2, GETS_NORMAL, ret4)
ret3 = utf8.import(arabic_decode2, arabic_decode1)
ret5 = seq.close(ret2)


Thank you