problems creating UNICODE directories

Post Reply
marzio
Posts: 129
Joined: Wed Apr 04, 2007 6:54 am

problems creating UNICODE directories

Post by marzio »

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
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: problems creating UNICODE directories

Post by nageswaragunupudi »

With Harbour (but not with xHarbour)

Code: Select all | Expand

HB_SETCODEPAGE( "UTF8" )
MAKEDIR( "తెలుగు" )
 

Worked for me.

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

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: problems creating UNICODE directories

Post by nageswaragunupudi »

You can use these functions to create unicode folders.
Works with Harbour and xHarbour

Code: Select all | Expand


#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
marzio
Posts: 129
Joined: Wed Apr 04, 2007 6:54 am

Re: problems creating UNICODE directories

Post by marzio »

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
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: problems creating UNICODE directories

Post by nageswaragunupudi »

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
User avatar
richard-service
Posts: 807
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan
Has thanked: 1 time
Contact:

Re: problems creating UNICODE directories

Post by richard-service »

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 (r2402101027) => Borland C++ v7.7 32bit
MySQL v8.0 /ADS v10
Harbour 3.2.0dev (r2011030937) => Borland C++ v7.4 64bit
marzio
Posts: 129
Joined: Wed Apr 04, 2007 6:54 am

Re: problems creating UNICODE directories

Post by marzio »

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.
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: problems creating UNICODE directories

Post by nageswaragunupudi »

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

G. N. Rao.
Hyderabad, India
marzio
Posts: 129
Joined: Wed Apr 04, 2007 6:54 am

Re: problems creating UNICODE directories

Post by marzio »

i see the wrong directory with file Explorer and with total commander.
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: problems creating UNICODE directories

Post by nageswaragunupudi »

To start with, I have a directory c:\fwh\test, which is empty.
Now I ran this program, built with Harbour and FWH

Code: Select all | Expand

#include "fivewin.ch"

function Main()

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

return nil
 


Result:
Image

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

Screen shot from my File Explorer
Image

You can not expect TotalCommander to display Unicode names.
Regards

G. N. Rao.
Hyderabad, India
marzio
Posts: 129
Joined: Wed Apr 04, 2007 6:54 am

Re: problems creating UNICODE directories

Post by marzio »

can you try your example without fiwewin?

i can confirm you that total commander visualizes correctly files and directories in unicode format.
marzio
Posts: 129
Joined: Wed Apr 04, 2007 6:54 am

Re: problems creating UNICODE directories

Post by marzio »

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
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: problems creating UNICODE directories

Post by nageswaragunupudi »

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
marzio
Posts: 129
Joined: Wed Apr 04, 2007 6:54 am

Re: problems creating UNICODE directories

Post by marzio »

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.
Post Reply