Bug? cGetDir() on utf8

Bug? cGetDir() on utf8

Postby ssbbs » Thu Apr 16, 2020 2:57 pm

Code: Select all  Expand view

        HB_SetCodePage("UTF8")
        HB_CDPSELECT("UTF8")
        //
        FW_SetUnicode(.T.)
        cIniDir:="c:/temp/中文目錄"
        cTmpDir := AllTrim( cGetDir( "請選擇圖片存放路徑",  cIniDir, .T. ))
 


please change '/' to '\'


Title is ugly code!!

Image
line ID: ssbbstw
WeChat ID: ssbbstw
User avatar
ssbbs
 
Posts: 104
Joined: Mon Oct 17, 2005 3:03 am
Location: Taiwan

Re: Bug? cGetDir() on utf8

Postby karinha » Thu Apr 16, 2020 3:18 pm

As I don't understand Chinese, try this model.

Code: Select all  Expand view

#include "FiveWin.ch"

#define BIF_NONEWFOLDERBUTTON  0x200
#define BIF_RETURNONLYFSDIRS   0x0001
#define BIF_DONTGOBELOWDOMAIN  0x0002
#define BIF_STATUSTEXT         0x0004
#define BIF_RETURNFSANCESTORS  0x0008
#define BIF_EDITBOX            0x0010
#define BIF_VALIDATE           0x0020
#define BIF_NEWDIALOGSTYLE     0x0040
#define BIF_USENEWUI  (BIF_NEWDIALOGSTYLE | BIF_EDITBOX)
#define BIF_BROWSEINCLUDEURLS  0x0080
#define BIF_BROWSEFORCOMPUTER  0x1000
#define BIF_BROWSEFORPRINTER   0x2000
#define BIF_BROWSEINCLUDEFILES 0x4000
#define BIF_SHAREABLE          0x8000
#define MAX_PATH 260

FUNCTION Main()

   LOCAL cTitle, cPath, cCarpDest, cPathDest

   cTitle    := "Seleccione Carpeta"

   cPath := GETCURDIR()

   cCarpDest := "Seleccione la carpeta donde copiar las novedades"

   cPathDest := cGetDir( cTitle, cPath,, cCarpDest,                     ;
                         BIF_RETURNONLYFSDIRS + BIF_DONTGOBELOWDOMAIN + ;
                         BIF_USENEWUI + BIF_NONEWFOLDERBUTTON )

   IF .NOT. EMPTY( cPathDest )
      ? cPathDest
   ENDIF

RETURN NIL
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7811
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Bug? cGetDir() on utf8

Postby ssbbs » Thu Apr 16, 2020 3:37 pm

karinha wrote:As I don't understand Chinese, try this model.

Code: Select all  Expand view

#include "FiveWin.ch"

#define BIF_NONEWFOLDERBUTTON  0x200
#define BIF_RETURNONLYFSDIRS   0x0001
#define BIF_DONTGOBELOWDOMAIN  0x0002
#define BIF_STATUSTEXT         0x0004
#define BIF_RETURNFSANCESTORS  0x0008
#define BIF_EDITBOX            0x0010
#define BIF_VALIDATE           0x0020
#define BIF_NEWDIALOGSTYLE     0x0040
#define BIF_USENEWUI  (BIF_NEWDIALOGSTYLE | BIF_EDITBOX)
#define BIF_BROWSEINCLUDEURLS  0x0080
#define BIF_BROWSEFORCOMPUTER  0x1000
#define BIF_BROWSEFORPRINTER   0x2000
#define BIF_BROWSEINCLUDEFILES 0x4000
#define BIF_SHAREABLE          0x8000
#define MAX_PATH 260

FUNCTION Main()

   LOCAL cTitle, cPath, cCarpDest, cPathDest

   cTitle    := "Seleccione Carpeta"

   cPath := GETCURDIR()

   cCarpDest := "Seleccione la carpeta donde copiar las novedades"

   cPathDest := cGetDir( cTitle, cPath,, cCarpDest,                     ;
                         BIF_RETURNONLYFSDIRS + BIF_DONTGOBELOWDOMAIN + ;
                         BIF_USENEWUI + BIF_NONEWFOLDERBUTTON )

   IF .NOT. EMPTY( cPathDest )
      ? cPathDest
   ENDIF

RETURN NIL
 


Regards, saludos.


Sorry!! I test it and still fail.
line ID: ssbbstw
WeChat ID: ssbbstw
User avatar
ssbbs
 
Posts: 104
Joined: Mon Oct 17, 2005 3:03 am
Location: Taiwan

Re: Bug? cGetDir() on utf8

Postby Natter » Thu Apr 16, 2020 5:09 pm

you can try this

cDirTmp:=OemToAnsi(HB_UTF8ToStr(cGetDir()))
Natter
 
Posts: 1215
Joined: Mon May 14, 2007 9:49 am

Re: Bug? cGetDir() on utf8

Postby ssbbs » Fri Apr 17, 2020 1:49 am

Natter wrote:you can try this

cDirTmp:=OemToAnsi(HB_UTF8ToStr(cGetDir()))


There are two problems!!
1. Title is showing garbled characters.
2. The initial directory is not expanded

Image
line ID: ssbbstw
WeChat ID: ssbbstw
User avatar
ssbbs
 
Posts: 104
Joined: Mon Oct 17, 2005 3:03 am
Location: Taiwan

Re: Bug? cGetDir() on utf8

Postby nageswaragunupudi » Sun Apr 19, 2020 2:33 am

The present implementation has limitations in Unicode support.

If the user selects a folder containting Unicode characters, the function returns the Unicode test correctly.

Limitations:
1) Title of the dialog can not be Unicode. This is provided in next version.
Sencond title, inside the dialog can be Unicode even in this version
2) Initdir can not be Unicode text. We are still to find a solution.

With the present version, this can be tried:
Code: Select all  Expand view

? cGetDir( "", cInitDir, nil, "請選擇圖片存放路徑" )
// cInitDir can not contain Unicode characters"
 


Image

In the next version to be released soon we can have dialog title in Unicode
Code: Select all  Expand view

   local cTitle   := "請選擇圖片存放路徑"
   ? cGetDir( cTitle, cInitDir, nil, cTitle + " 中文目錄" )
 


Image

Still, cInitDir can not contain Unicode path. We are working on it.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10631
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Bug? cGetDir() on utf8

Postby ssbbs » Sun Apr 19, 2020 8:59 am

I have solved this problem!
Image
line ID: ssbbstw
WeChat ID: ssbbstw
User avatar
ssbbs
 
Posts: 104
Joined: Mon Oct 17, 2005 3:03 am
Location: Taiwan

Re: Bug? cGetDir() on utf8

Postby nageswaragunupudi » Sun Apr 19, 2020 9:52 am

Can you please share with us how did you solve this problem?
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10631
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Bug? cGetDir() on utf8

Postby ssbbs » Sun Apr 19, 2020 1:27 pm

nageswaragunupudi wrote:Can you please share with us how did you solve this problem?

Give me some rewards, ex: free update once! :mrgreen:
line ID: ssbbstw
WeChat ID: ssbbstw
User avatar
ssbbs
 
Posts: 104
Joined: Mon Oct 17, 2005 3:03 am
Location: Taiwan

Re: Bug? cGetDir() on utf8

Postby richard-service » Thu Jul 09, 2020 11:29 am

Hi Mr.Rao

Any news?
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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 90 guests