PDA

View Full Version : Problems with ASCII command from a Hex 93



Edgard
23-Sep-2021, 08:38 AM
Harm, sorry to raise the RO topic here:
https://support.dataaccess.com/Forums/showthread.php?66811-Character-and-ASCII-how-they-are-supposed-to-work&p=364132


But that's not what I'm currently seeing in the ASCII function.


Monthly I receive a file from a Brazilian statistical entity in .DBF format.


14859

I adjusted my encoding, to work from the first version of DF20 and today: (20.0.7.152).

In this month's file when reading via Read_Block I have: Hex 93.

When performing the format conversion and executing the Ascii command, I receive as a return: 8220.

Seeing the link, which appears in the manual:
https://unicode-table.com/pt/#0093


14858

I think the whole range from 127 to 160 should return an erratic value.


I should be getting the return: 147, as is the value in DF19, contradicting your words.


I tried some variations of commands and was not successful.

My code (summarized) looks like this:



Integer iVal
String sDb
Address aUTFBuffer


Read_Block channel 1 sDb 1
Get Utf8FromBuffer of oCharTranslate (AddressOf(sDb)) CP_ACP to aUTFBuffer
Get Utf8ToStr of oCharTranslate aUTFBuffer CP_UTF8 to sDb
Move (Ascii(sDb)) to iVal





Best Regards,

Edgard

Edgard
8-Dec-2021, 08:11 AM
Atualização...
O mesmo ocorre no DF 20.1 - Beta 2.


Talvez eu não tenha me expressado bem sobre o

problema.







De qualquer forma eu atualizei a codificação, para: uChar [] ucMyVar Read_Block canal 1 ucMyVar -1 Os problemas acabaram.

Lembranças,

Harm Wibier
9-Dec-2021, 02:47 AM
Google Translate tells me you solved your issue, so I am happy to hear that!

Edgard
9-Dec-2021, 02:55 PM
Yes . . . me either :D!


We insist on continuing to use commands from the past, which don't always work in all situations.


In this case, it was better to use newer and more efficient commands.


Suggestion on compiler warning or help:


Example:


Up to DF19.1 (Allowed):


String sBlock


Direct_Input channel 1 "BINARY: C:\Temp\NameFile.dbf"


If (SeqEof=False);
Read_Block channel 1 sBlock 3


From DF20 the above command is obsolete, use:


uchar [] ucBlock


Direct_Input channel 1 "BINARY: C:\Temp\NameFile.dbf"


If (SeqEof=False);
Read_Block channel 1 ucBlock -1

Regards,

Edgard