problems creating UNICODE directories

problems creating UNICODE directories

Postby marzio » Tue May 03, 2016 8: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
marzio
 
Posts: 129
Joined: Wed Apr 04, 2007 6:54 am

Re: problems creating UNICODE directories

Postby nageswaragunupudi » Tue May 03, 2016 11:42 am

With Harbour (but not with xHarbour)
Code: Select all  Expand view
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: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: problems creating UNICODE directories

Postby nageswaragunupudi » Tue May 03, 2016 12:42 pm

You can use these functions to create unicode folders.
Works with Harbour and xHarbour
Code: Select all  Expand view

#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
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: problems creating UNICODE directories

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

Re: problems creating UNICODE directories

Postby nageswaragunupudi » Wed May 04, 2016 7: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
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: problems creating UNICODE directories

Postby richard-service » Wed May 04, 2016 5: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 (r2402101027) => Borland C++ v7.7 32bit
MySQL v8.0 /ADS v10
Harbour 3.2.0dev (r2011030937) => Borland C++ v7.4 64bit
User avatar
richard-service
 
Posts: 803
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan

Re: problems creating UNICODE directories

Postby marzio » Thu May 05, 2016 9: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.
marzio
 
Posts: 129
Joined: Wed Apr 04, 2007 6:54 am

Re: problems creating UNICODE directories

Postby nageswaragunupudi » Thu May 05, 2016 9: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
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: problems creating UNICODE directories

Postby marzio » Thu May 05, 2016 9:14 am

i see the wrong directory with file Explorer and with total commander.
marzio
 
Posts: 129
Joined: Wed Apr 04, 2007 6:54 am

Re: problems creating UNICODE directories

Postby nageswaragunupudi » Thu May 05, 2016 9: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: Select all  Expand view
#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
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: problems creating UNICODE directories

Postby marzio » Thu May 05, 2016 9:55 am

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

Postby marzio » Fri May 06, 2016 7: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
marzio
 
Posts: 129
Joined: Wed Apr 04, 2007 6:54 am

Re: problems creating UNICODE directories

Postby nageswaragunupudi » Fri May 06, 2016 3: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
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: problems creating UNICODE directories

Postby marzio » Wed May 11, 2016 7: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.
marzio
 
Posts: 129
Joined: Wed Apr 04, 2007 6:54 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 97 guests