Page 2 of 2

Re: Copy File Name

Posted: Fri Jan 21, 2022 5:03 pm
by Natter
dim:=directory(MyFolder+"\*.*")

Re: Copy File Name

Posted: Fri Jan 21, 2022 5:51 pm
by karinha

Re: Copy File Name

Posted: Sat Jan 22, 2022 8:45 am
by Natter
I did not make an empty text file .
https://cloud.mail.ru/public/jKRA/mDdPAAgoS
The header of this file consists of 3 characters D090 D090 CC86.
D0 is Cyrillic UTF-8. After reading this file through directory() I will get AA?.txt because the FW not recognize the CC86 symbol. This symbol must be deleted. I can edit the file headers in Explorer or TC, but there are a lot of files with the CC86 symbol in my name on the network (I haven't figured out where yet), You can rename such files from FW, apparently, through the bat file

chcp 1251
cmd ren C:\file1*.pdf file2.pdf

or bat file Powershell

Re: Copy File Name

Posted: Sun Jan 23, 2022 7:54 am
by Otto
Hello Natter,
I didn't think I would deal with this problem so quickly myself.
Are you using xHarbur or Harbour.
With Chinese characters my test program compiled with Harbor works fine. But not with xHarbour.



Best regards,
Otto

Code: Select all | Expand


#include "fivewin.ch"
     #include "ini.ch"
     
     #include "adodef.ch"
     #include "ord.ch"
     #include "xbrowse.ch"
               
     function Main()
     
      local I, cVData
      local cReturn := ""
           
      HB_CDPSELECT( "UTF8" )
      FW_SetUnicode( .T. )
           
      aDir := directory( "C:\test\source\C*.*","DHS")
      xbrowse(aDir )
           
      cVData := aDir[1,1]
     
      for I := 1 to len(cVData)
        cReturn += (str(I) + "-" + cVData + CRLF + substr( cVData, I, 1 ) + " # "+ str( ASC ( substr( cVData, I, 1 ) ) ))  + CRLF
      next
           
      ? cReturn
     
      ? memoread( "C:\test\source\" + cVData ) 
     
     
     
     
    return nil

Re: Copy File Name

Posted: Mon Jan 24, 2022 9:20 am
by Otto
Dear Antonio,
with HARBOUR this is working fine. It is not working for me with xHarbour. But I switched the project to HARBOUR.

Best regards,
Otto
HARBOURINO now supports
HB_CDPSELECT( "UTF8" )
FW_SetUnicode( .T. )

Image

Image

Re: Copy File Name

Posted: Mon Jan 24, 2022 10:20 am
by Natter
Otto, I built your program under Harbor and tried to read the file (not empty). I get empty :cry:

Re: Copy File Name

Posted: Mon Jan 24, 2022 11:12 am
by cnavarro
Look my screen ( file list on the left of the screen ) and tell me better your problem
Image