• Romania characters file open

    From danijel koprivnjak@21:1/5 to All on Mon Aug 1 03:26:47 2022
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dlzc@21:1/5 to danijel.k...@gmail.com on Mon Aug 1 08:39:49 2022
    On Monday, August 1, 2022 at 3:26:48 AM UTC-7, danijel.k...@gmail.com wrote:
    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 ?

    * 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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jamal@21:1/5 to danijel koprivnjak on Tue Aug 2 01:54:33 2022
    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

    On 8/1/2022 6:26 AM, danijel koprivnjak wrote:
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Phil McGuinness@21:1/5 to Jamal on Wed Aug 3 18:39:41 2022
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)