DESCEND( DTOS( dDate ) )
USE Sales NEW
INDEX ON Str(Descend(SaleDate)) + Salesman TO LastSale
OR
USE Sales NEW
INDEX ON Descend(OrdDate) TO SalesDate
DESCEND( dDate )
DESCEND( DTOS( dDate ) )
DESCEND( STR( nVal ) ) => STR( 999999999999999 - nVal )
DESCEND( DTOS( dVal ) ) => STR( DESCEND( dVal ) )
DESCEND() function is designed to operate on binary (BYTE) sorting
and gives reverted collation order only for codepages which use
such collation.
Because DESCEND() converts numbers to characters which have
special order in CP you are using. Look at this list archive
for some easy to create custom DESCEND() replacements which
can be used with non accented Latin based languages like
Lithuanian or Polish ones.
REQUEST HB_LANG_IT
REQUEST HB_CODEPAGE_ITWIN, HB_CODEPAGE_IT850
HB_CDPSELECT( "IT850" )
hb_langSelect( 'IT' )
// hb_SetTermCP( 'ITWIN', 'ITWIN', .T. ) // Also with it run ok
#include "Fivewin.ch"
REQUEST HB_LANG_IT
REQUEST HB_CODEPAGE_ITWIN, HB_CODEPAGE_IT850
FUNCTION MAIN()
HB_CDPSELECT( "IT850" )
HB_LANGSELECT( "IT" )
HB_SETTERMCP( "ITWIN", "ITWIN", .T. )
MEMOWRIT( "àèéìòù.txt", "àèéìòù" )
RETURN NIL
Enrico Maria Giordano wrote:It doesn't work, it creates a file with the wrong name. Please try this:
- Code: Select all Expand view RUN
#include "Fivewin.ch"
REQUEST HB_LANG_IT
REQUEST HB_CODEPAGE_ITWIN, HB_CODEPAGE_IT850
FUNCTION MAIN()
HB_CDPSELECT( "IT850" )
HB_LANGSELECT( "IT" )
HB_SETTERMCP( "ITWIN", "ITWIN", .T. )
MEMOWRIT( "àèéìòù.txt", "àèéìòù" )
RETURN NIL
Enrico Maria Giordano wrote:The problem is: without any codepage settings (ie. EN codepage) Descend() is fine but accented chars from filesystem are wrong. With ITWIN (or other codepages I tried) the accented chars from filesystem are right but Descend() is not working.
Any solutions will make me happy.
#include "Fivewin.ch"
FUNCTION MAIN()
LOCAL aData[ 7 ]
LOCAL i
HB_SETCODEPAGE( "UTF8" )
aData[ 1 ] = { "TEST1", 3107.77 }
aData[ 2 ] = { "TEST2", 852.07 }
aData[ 3 ] = { "TEST3", 191.00 }
aData[ 4 ] = { "TEST4", 148.68 }
aData[ 5 ] = { "TEST5", 44.73 }
aData[ 6 ] = { "TEST6", 15.24 }
aData[ 7 ] = { "TEST7", 255.65 }
ASORT( aData, , , { | aItem1, aItem2 | Descend( Str( aItem1[ 2 ], 10, 2 ) ) + aItem1[ 1 ] < Descend( Str( aItem2[ 2 ], 10, 2 ) ) + aItem2[ 1 ] } )
xBrowse( aData )
hb_MemoWrit( "àèéìòù.txt", "àèéìòù" )
RETURN NIL
? hb_MemoWrit( "àèéìòù.txt", "àèéìòù" )
.F.
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 58 guests