FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour problems creating UNICODE directories
Posts: 193
Joined: Wed Apr 04, 2007 06:54 AM
problems creating UNICODE directories
Posted: Tue May 03, 2016 08:28 AM

i want to create directories with unicode characters, but none of the functions tried works well.
lMkDir(), MakeDir() fwh1507, bcc7, xHarbour 1.2.3 bcc7_20150603

DLL32 Function apiCreateDir(lpPathName AS STRING, lpSecurityAttributes AS LPSTR) AS LONG PASCAL FROM "CreateDirectoryW" LIB "kernel32.dll"
apiCreateDir("c:\Dir ∞ Dir") creates a directory with chinese character in the directory of exe file instead of "c:\Dir ∞ Dir" with infinite symbol.

CreateDirectoryW of kernel32.dll is declared like unicode version.
any suggestion?
marzio

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: problems creating UNICODE directories
Posted: Tue May 03, 2016 11:42 AM
With Harbour (but not with xHarbour)
Code (fw): Select all Collapse
HB_SETCODEPAGE( "UTF8" )
MAKEDIR( "తెలుగు" )

Worked for me.

We shall now enhance FW functions to work with Unicode names
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: problems creating UNICODE directories
Posted: Tue May 03, 2016 12:42 PM
You can use these functions to create unicode folders.
Works with Harbour and xHarbour
Code (fw): Select all Collapse
#pragma BEGINDUMP

#include <windows.h>
#include <hbapi.h>

LPWSTR   fw_parWide( int iParam );               // source: msgsapi.c

HB_FUNC( LMKDIRW )
{
   BOOL bRet;

   LPWSTR pW;

   pW = fw_parWide( 1 );
   bRet = CreateDirectoryW( pW, 0 );
   hb_xfree( ( void * ) pW );

   hb_retl( bRet );
}

#include <shlobj.h>

HB_FUNC (LMKFULLPATHW)
{
   BOOL bRet;

   LPWSTR pW;

   pW = fw_parWide( 1 );
   bRet = ( SHCreateDirectoryExW( NULL, pW, NULL ) == 0 );
   hb_xfree( ( void * ) pW );

   hb_retl( bRet );

}

#pragma ENDDUMP


lMkDirW() for relative path
lMkFullPathW() for full path

You need any FWH version during 2016
Regards



G. N. Rao.

Hyderabad, India
Posts: 193
Joined: Wed Apr 04, 2007 06:54 AM
Re: problems creating UNICODE directories
Posted: Wed May 04, 2016 07:39 AM

many thanks for your reply!

i have tried:
HB_SETCODEPAGE( "UTF8" )
MAKEDIR( "తెలుగు" )
but it doesn't work.

for the second soution that require fw_parWide() i shall update to fwh 2016 version.
thanks, marzio

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: problems creating UNICODE directories
Posted: Wed May 04, 2016 07:53 AM
i have tried:
HB_SETCODEPAGE( "UTF8" )
MAKEDIR( "తెలుగు" )

As I said, this work only with Harbour. Not with xHarbour.

Even normal DIRECTORY() function works with Unicode names in Harbour but not with xHarbour.

If you plan to use Unicode, it is worth considering upgrading FWH.
After reading your post, we are planning to enhance FWH's directory functions to work with Unicode names.
Regards



G. N. Rao.

Hyderabad, India
Posts: 866
Joined: Tue Oct 16, 2007 08:57 AM
Re: problems creating UNICODE directories
Posted: Wed May 04, 2016 05:44 PM
nageswaragunupudi wrote:
i have tried:
HB_SETCODEPAGE( "UTF8" )
MAKEDIR( "తెలుగు" )

As I said, this work only with Harbour. Not with xHarbour.

Even normal DIRECTORY() function works with Unicode names in Harbour but not with xHarbour.

If you plan to use Unicode, it is worth considering upgrading FWH.
After reading your post, we are planning to enhance FWH's directory functions to work with Unicode names.


How about it support xHarbour? I'm use xHarbour now.
Best Regards,



Richard



Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 32bit

MySQL v8.0

Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 64bit
Posts: 193
Joined: Wed Apr 04, 2007 06:54 AM
Re: problems creating UNICODE directories
Posted: Thu May 05, 2016 09:00 AM

i have tried:
HB_SETCODEPAGE( "UTF8" )
MAKEDIR( "తెలుగు" )
with harbour 3.0.0, borland c++7 without fivewin

but i obtain a directory like this: తెలుగు

what is wrong?
thanks.

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: problems creating UNICODE directories
Posted: Thu May 05, 2016 09:01 AM

You can view the folder name correctly with FileExplorer and also with Harbour's DIRECTORY() function. Not xHarbour

Regards



G. N. Rao.

Hyderabad, India
Posts: 193
Joined: Wed Apr 04, 2007 06:54 AM
Re: problems creating UNICODE directories
Posted: Thu May 05, 2016 09:14 AM

i see the wrong directory with file Explorer and with total commander.

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: problems creating UNICODE directories
Posted: Thu May 05, 2016 09:39 AM
To start with, I have a directory c:\fwh\test, which is empty.
Now I ran this program, built with Harbour and FWH
Code (fw): Select all Collapse
#include "fivewin.ch"

function Main()

   FW_SetUnicode( .t. )
   HB_SETCODEPAGE( "UTF8" )
   MAKEDIR( "c:\fwh\test\" + "తెలుగు" )
   XBROWSER DIRECTORY( "c:\fwh\test\*.*", 'D' )

return nil


Result:


You can see the unicode name in the xbrowse (3rd row)

Screen shot from my File Explorer


You can not expect TotalCommander to display Unicode names.
Regards



G. N. Rao.

Hyderabad, India
Posts: 193
Joined: Wed Apr 04, 2007 06:54 AM
Re: problems creating UNICODE directories
Posted: Thu May 05, 2016 09:55 AM

can you try your example without fiwewin?

i can confirm you that total commander visualizes correctly files and directories in unicode format.

Posts: 193
Joined: Wed Apr 04, 2007 06:54 AM
Re: problems creating UNICODE directories
Posted: Fri May 06, 2016 07:46 AM

i have inserted FW_SetUnicode( .T. ) supported by fwh1507 but i have linking error:

Error: Unresolved external '_HB_FUN_HB_BLEN' referenced from T:\MARZIO\WINCLIP\FWH1507\LIB\FIVEH.LIB|OLEFUNCS
Error: Unresolved external '_hb_extIsNil' referenced from T:\MARZIO\WINCLIP\FWH1507\LIB\FIVEHC.LIB|RICHEDIT
Error: Unresolved external '_HB_FUN___OLEVARIANTNEW' referenced from T:\MARZIO\WINCLIP\FWH1507\LIB\FIVEH.LIB|ADOFUNCS
Error: Unable to perform link

the library hbwin is linked.
which library is missing?

echo %bcdir%\lib\c0w32.obj + > b32.bc
echo %1.obj, + >> b32.bc
echo %1.exe, + >> b32.bc
echo %1.map, + >> b32.bc
echo %fwh%\lib\FiveH.lib + >> b32.bc
echo %fwh%\lib\FiveHC.lib + >> b32.bc
echo %fwh%\lib\libmysql.lib + >> b32.bc
echo %fwh%\lib\dolphin.lib + >> b32.bc
echo %hdirl%\hbwin.lib + >> b32.bc
echo %hdirl%\gtgui.lib + >> b32.bc
echo %hdirl%\gtwin.lib + >> b32.bc
echo %hdirl%\hbrtl.lib + >> b32.bc
echo %hdirl%\hbvm.lib + >> b32.bc
echo %hdirl%\hblang.lib + >> b32.bc
echo %hdirl%\hbmacro.lib + >> b32.bc
echo %hdirl%\hbrdd.lib + >> b32.bc
echo %hdirl%\rddntx.lib + >> b32.bc
echo %hdirl%\rddcdx.lib + >> b32.bc
echo %hdirl%\rddfpt.lib + >> b32.bc
echo %hdirl%\hbsix.lib + >> b32.bc
echo %hdirl%\hbdebug.lib + >> b32.bc
echo %hdirl%\hbcommon.lib + >> b32.bc
echo %hdirl%\hbpp.lib + >> b32.bc
echo %hdirl%\hbcpage.lib + >> b32.bc
echo %hdirl%\hbcplr.lib + >> b32.bc
echo %hdirl%\hbct.lib + >> b32.bc
echo %hdirl%\hbpcre.lib + >> b32.bc
echo %hdirl%\xhb.lib + >> b32.bc
echo %hdirl%\hbziparc.lib + >> b32.bc
echo %hdirl%\hbmzip.lib + >> b32.bc
echo %hdirl%\hbzlib.lib + >> b32.bc
echo %hdirl%\minizip.lib + >> b32.bc
echo %hdirl%\png.lib + >> b32.bc
echo %hdirl%\hbusrrdd.lib + >> b32.bc

echo %bcdir%\lib\cw32.lib + >> b32.bc
echo %bcdir%\lib\uuid.lib + >> b32.bc
echo %bcdir%\lib\import32.lib + >> b32.bc
echo %bcdir%\lib\ws2_32.lib + >> b32.bc
echo %bcdir%\lib\psdk\odbc32.lib + >> b32.bc
echo %bcdir%\lib\psdk\nddeapi.lib + >> b32.bc
echo %bcdir%\lib\psdk\iphlpapi.lib + >> b32.bc
echo %bcdir%\lib\psdk\msimg32.lib + >> b32.bc
echo %bcdir%\lib\psdk\psapi.lib + >> b32.bc
echo %bcdir%\lib\psdk\rasapi32.lib + >> b32.bc
echo %bcdir%\lib\psdk\gdiplus.lib + >> b32.bc
echo %bcdir%\lib\psdk\shell32.lib, >> b32.bc

IF EXIST %1.res echo %1.res >> b32.bc
if %GT% == gtwin %bcdir%\bin\ilink32 -Gn -Tpe -s @b32.bc
IF ERRORLEVEL 1 GOTO LINKERROR
if %GT% == gtgui %bcdir%\bin\ilink32 -Gn -aa -Tpe -s @b32.bc

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: problems creating UNICODE directories
Posted: Fri May 06, 2016 03:02 PM
We provided Unicode support from 15.09 onwards.

How about it support xHarbour? I'm use xHarbour now.

We keep extending support for Unicode in FWH dir functions. But for full implementation Harbour is a better choice.
In FWH 16.04 new functions lIsDirW(), lMkDirW(), FileW(), lRmDirW(), lChDirW() provide Unicode support.

In my view it is a good idea to maintain file-system in English and handle data/contents in Unicode.
Regards



G. N. Rao.

Hyderabad, India
Posts: 193
Joined: Wed Apr 04, 2007 06:54 AM
Re: problems creating UNICODE directories
Posted: Wed May 11, 2016 07:56 AM
i have resolved substituting Harbour 3.0 with Harbour 3.2
Now the creation of the directories with unicode characters works fine!!
(hb3.2, fwh1507, bcc7)
thanks.

Continue the discussion