Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Romania characters file open

43 views
Skip to first unread message

danijel koprivnjak

unread,
Aug 1, 2022, 6:26:48 AM8/1/22
to
Hi,
I have a request to check Romanian files (txt files),
but I have big problems with the Romanian code page
When I open the file, I can't get two characters, I can't read characters ş and ț
cBuffer := MemAlloc(F_BLOCK)
IF cBuffer = NULL_PTR
RETURN FALSE
ENDIF
nHandleImport:=FOpen2(cImportFile,FO_READ+FO_EXCLUSIVE,NULL_STRING)
nHandleCheck :=FCreate( cExportFile,FC_NORMAL )
FRead4(nHandleImport, cBuffer, F_BLOCK,FALSE)
FWrite4(nHandleCheck, cBuffer,PszLen(cBuffer), FALSE)

FClose(nHandleImport)
MemFree(cBuffer)

I open the file, read it, save it and I have difference in the header and of course I don't get the above characters.

Any idea ?
many thx
Best
Danijel

dlzc

unread,
Aug 1, 2022, 11:39:50 AM8/1/22
to
* I don't see a FClose operation nHandleCheck.

* Your aren't saying if the problem is in "file name" or "file contents".

* What is the size of cBuffer, right after you create it?

* I don't recognize the syntax FRead4 and FWrite4... are these built-ins or home-rolled?

* What character sets does PszLen recognize? Any options that do not require null terminated (assuming) strings?

Places I'd suggest you look.

David A. Smith

Jamal

unread,
Aug 2, 2022, 1:54:38 AM8/2/22
to
Hi Danijel,

This is possibly due to the OEM to ANSI conversion since you are passing
FALSE in the 4th parameter of the FRead4() function. Try passing TRUE:

FRead4(nHandleImport, cBuffer, F_BLOCK, TRUE)

The same goes for FWrite4().


You may also try using FReadLine() which is not dependent upon the
status of SetAnsi(). From the VO documentation:

Sample:

ptrHandle := FOpen2("docs.txt", FO_READ)

IF ptrHandle != F_ERROR

DO WHILE !FEOF(ptrHandle)

? FReadLine(ptrHandle)

ENDDO

ENDIF

FClose(ptrHandle)


Jamal

Phil McGuinness

unread,
Aug 3, 2022, 9:39:42 PM8/3/22
to
On Tuesday, August 2, 2022 at 3:54:38 PM UTC+10, Jamal wrote:
> Hi Danijel,

Trie setting ;

SetAnsi(TRUE) // DO NOT Remove required for correct CHR values EOM to ANSI elsc CSV contain UTF8/OEM chars

Before processing the file.

Phil

0 new messages