UPPER() and IsAlpha() return not reals values in french
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: UPPER() and IsAlpha() return not reals values in french
Why can't you use your own function for this?
EMG
EMG
- Badara Thiam
- Posts: 160
- Joined: Tue Oct 18, 2005 10:21 am
- Location: France
- Contact:
Re: UPPER() and IsAlpha() return not reals values in french
Because i not found the way to replace Upper() by my own Upper() in xHarbour, and ADS reconize only "Upper" name in indexed keys.
My function Maj() do what Clipper do, and it is not a problem when i don't use ADS. I cannot use ADS only because this.
My function Maj() do what Clipper do, and it is not a problem when i don't use ADS. I cannot use ADS only because this.
Badara Thiam
http://www.icim.fr
http://www.icim.fr
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: UPPER() and IsAlpha() return not reals values in french
I think ADS would use its own function anyway.
EMG
EMG
- Badara Thiam
- Posts: 160
- Joined: Tue Oct 18, 2005 10:21 am
- Location: France
- Contact:
Re: UPPER() and IsAlpha() return not reals values in french
But if ADS is not connected, or if we want change RDD to DBFCDX for example, Upper() of xHarbour is used, who is not compatible with alphabétic order. Because the ASCII codes of all accented chars are after the ASCII code of "Z". This is why it is necessary to "destroy" all accents in Upper() fonction. Upper() of xHarbour gives the real upper chars, but this function would be UpperReal(), not Upper(). Simply Restore Upper() like Clipper do, to keep FULL compatibility in all RDD without changes in the code.
Badara Thiam
http://www.icim.fr
http://www.icim.fr
- Badara Thiam
- Posts: 160
- Joined: Tue Oct 18, 2005 10:21 am
- Location: France
- Contact:
Re: UPPER() and IsAlpha() return not reals values in french
Solved in great part by insert RDDInit() on the start of main .prg,
after reminder by David A. Smith in xHarbour forum.
Upper() continue to return accents in uppercase, but my alphabetic lists are very better. The "é" was after "z" before, now the "é" is before "e" and the "è" is after "e". This is not perfect but acceptable i think for my users.
Best Regards
after reminder by David A. Smith in xHarbour forum.
Upper() continue to return accents in uppercase, but my alphabetic lists are very better. The "é" was after "z" before, now the "é" is before "e" and the "è" is after "e". This is not perfect but acceptable i think for my users.
Best Regards
Badara Thiam
http://www.icim.fr
http://www.icim.fr
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: UPPER() and IsAlpha() return not reals values in french
Mr. Badara Thiam
I am sorry, I am unable to agree.
If we set codepage correctly, sorting and indexing by (x)Harbour is correct and respects the rules of the language set by the codepage.
It is NOT correct that (x)Harbour sorts alphabets by ASCI values. NO. It sorts the alphabets by the language collation rules.
This is the sample to test sorting of French alphabets:
Let us now test indexing. Please remember to USE dbf with CODEPAGE clause.
Both Harbour and xHarbour produce the same results.
I do not think there is anything wrong with the above collation.
I think we can safely rely on (x)Harbour.
I am sorry, I am unable to agree.
If we set codepage correctly, sorting and indexing by (x)Harbour is correct and respects the rules of the language set by the codepage.
It is NOT correct that (x)Harbour sorts alphabets by ASCI values. NO. It sorts the alphabets by the language collation rules.
This is the sample to test sorting of French alphabets:
Code: Select all
function FrenchCollation()
local cList, cSort, aList, n
HB_LangSelect("FR")
HB_SetCodePage("FRWIN")
cList := "azertyuiopéqsdfghjklmùwxcvbnèà"
? cList, Upper( cList )
aList := {}
for n := 1 to Len( cList )
AAdd( aList, { SubStr( cList, n, 1 ), , } )
aList[ n, 2 ] := ASC( aList[ n, 1 ] )
aList[ n, 3 ] := UPPER( aList[ n, 1 ] )
next
ASort( aList, , , { |x,y| x[ 1 ] < y[ 1 ] } )
XBROWSER aList TITLE "FRENCH SORTING" ;
SETUP ( oBrw:cHeaders := { "CHAR", "ASC", "UPPER" }, ;
oBrw:nDataStrAligns := AL_CENTER ) ;
SHOW RECID
return nil
Let us now test indexing. Please remember to USE dbf with CODEPAGE clause.
Code: Select all
function frenchIndexing()
field FLDCHR, FLDASC
local cList, n
HB_LangSelect("FR")
HB_SetCodePage("FRWIN")
cList := "azertyuiopéqsdfghjklmùwxcvbnèà"
? cList, Upper( cList )
FERASE( "TFRENCH.CDX" )
DBCREATE( "TFRENCH.DBF", { { "FLDCHR", "C", 1, 0 }, { "FLDASC", "N", 5, 0 } }, "DBFCDX" )
USE TFRENCH NEW EXCLUSIVE VIA "DBFCDX" CODEPAGE "FRWIN"
for n := 1 to Len( cList )
DBAPPEND()
FLDCHR := SubStr( cList, n, 1 )
FLDASC := ASC( FLDCHR )
next
INDEX ON UPPER(FLDCHR) TAG FLDCHR
GO TOP
XBROWSER "TFRENCH" TITLE "FRENCH DBFCDX COLLATION" ;
COLUMNS "FLDCHR", "FLDASC", "ORDKEYVAL()" SHOW RECID ;
SETUP ( oBrw:nDataStrAligns := AL_CENTER )
return nil
Both Harbour and xHarbour produce the same results.
I do not think there is anything wrong with the above collation.
I think we can safely rely on (x)Harbour.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Badara Thiam
- Posts: 160
- Joined: Tue Oct 18, 2005 10:21 am
- Location: France
- Contact:
Re: UPPER() and IsAlpha() return not reals values in french
Dear G. N. Rao,
I could not use your browser because there is a « syntax error at SHOW » for my xHarbour compiler.
Here are lists with my internal browser, printed in pdf :
- http://icim.fr.free.fr/test/test-french ... -fr850.pdf
- http://icim.fr.free.fr/test/test-french ... -frwin.pdf
As you can see, it is better with FR850.
I have seen that the CODEPAGE parameter of USE is ignored. Only HB_SetCodePage() change something.
I could not use your browser because there is a « syntax error at SHOW » for my xHarbour compiler.
Here are lists with my internal browser, printed in pdf :
- http://icim.fr.free.fr/test/test-french ... -fr850.pdf
- http://icim.fr.free.fr/test/test-french ... -frwin.pdf
As you can see, it is better with FR850.
I have seen that the CODEPAGE parameter of USE is ignored. Only HB_SetCodePage() change something.
Badara Thiam
http://www.icim.fr
http://www.icim.fr
- Badara Thiam
- Posts: 160
- Joined: Tue Oct 18, 2005 10:21 am
- Location: France
- Contact:
Re: UPPER() and IsAlpha() return not reals values in french
I would point out that all the chars in my databases are not based on ANSI but on OEM, MS-DOS CP 850.
Since 1986 with Clipper. All that is put on the screen or printer with my Windows applications,
is translated before with OemToAnsi().
Since 1986 with Clipper. All that is put on the screen or printer with my Windows applications,
is translated before with OemToAnsi().
Badara Thiam
http://www.icim.fr
http://www.icim.fr
Re: UPPER() and IsAlpha() return not reals values in french
I would just create a separate field in your database where the accents are eliminated and use that for the index key.
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: UPPER() and IsAlpha() return not reals values in french
It is more than 30 years since 1986. Lot has changed since then. For all those who are maintaining data in ANSI, as is the present (default) practice, (x)Harbour default behaviour works perfectly.
One option available is to migrate the data to ANSI and use contemporary tools comfortably.
In ADS also, we can maintain data in ANSI and choose our preferred language collation.
One option available is to migrate the data to ANSI and use contemporary tools comfortably.
In ADS also, we can maintain data in ANSI and choose our preferred language collation.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India