UPPER() and IsAlpha() return not reals values in french

User avatar
Badara Thiam
Posts: 160
Joined: Tue Oct 18, 2005 10:21 am
Location: France
Contact:

UPPER() and IsAlpha() return not reals values in french

Post by Badara Thiam »

Hello, there is a long time ! Everybody works well ? :D

I submit to you this because it is a big problem for me (and maybe others french users) :
- I cannot use UPPER() function because it not return the good value
with accented characters. I was obliged to create my own function to replace UPPER(), but I cannot use it in the index keys with ADS, because ADS does not re-know this function, which has no same name because I did not find as to replace it in xHarbour.

It seems to me that IsAlpha() is the center of the problem. IsAlpha() with xHarbour return always .F. for accented characters.

Is this solved SINCE fwh 13.7 and xHarbour 1.2.1 ?
Badara Thiam
http://www.icim.fr
User avatar
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

Post by Badara Thiam »

Hi Enrico !

I prepare it to you. It is a little complex because translation ASCII-ANSI.

I retrieve this test function you gave to me and i modify it to try to see more :

Code: Select all

****************
FUNCTION FWTEST15()
****************
local i, c, u:={}, l:={}, a[256], s:="" 
LOCAL charsASCII :={}, charsANSI :={}

for i:=0 to 255 
  c:=chr(i) 

  if i >= 32
      aadd(charsASCII,c) 
      aadd(charsANSI,OemToAnsi(c)) 
  endif

  if isalpha(c) .and. ascan(u,c)==0 .and. ascan(l,c)==0 
    aadd(u,upper(c)) 
    aadd(l,lower(c)) 
  endif 
next 
asort(charsASCII)
asort(charsANSI)
asort(u) 
asort(l) 

s += "ASCII Codes 32-255 : "
aeval(charsASCII,{|x|s+=x}) 
s+=CRLF 

s += "ANSI Codes 32-255 : "
aeval(charsANSI,{|x|s+=x}) 
s+=CRLF 

s += "Upper() : "
aeval(u,{|x|s+=x}) 
s+=CRLF 

s += "Lower() : "
aeval(l,{|x|s+=x}) 
s+=CRLF 

memowrit("C:\letters.out", s) 
 
Last edited by Badara Thiam on Sun Jun 03, 2018 3:28 pm, edited 1 time in total.
Badara Thiam
http://www.icim.fr
User avatar
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

Post by Enrico Maria Giordano »

Please try something simpler like:

Code: Select all

? UPPER( "x" )
where x is one character that cannot be converted correctly by UPPER().

EMG
User avatar
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

Post by Badara Thiam »

Example : Upper("é"), Upper("è") or Upper("ê") must return "E"

Do you want the complete list of char impacted in french ?
Last edited by Badara Thiam on Sun Jun 03, 2018 3:39 pm, edited 1 time in total.
Badara Thiam
http://www.icim.fr
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: UPPER() and IsAlpha() return not reals values in french

Post by nageswaragunupudi »

1) This has nothing to do with FWH. These functions are from Harbour/xHarbour
2) If you set codepage to French, Upper and IsAlpha() work correctly
Regards

G. N. Rao.
Hyderabad, India
User avatar
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

Post by Badara Thiam »

Hi Nageswaragunupudi,

This is in my code :

HB_LangSelect("FR")
HB_SetCodePage("FR")
SET(_SET_LANGUAGE, "FR")
Badara Thiam
http://www.icim.fr
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: UPPER() and IsAlpha() return not reals values in french

Post by nageswaragunupudi »

This is a test with German language

Code: Select all

   HB_LangSelect("DE")
   HB_SetCodePage("DEWIN")

   c  := "öäü"
   ? c, UPPER( c ), ISALPHA( c )
 
Image

You may use

HB_LangSelect( "FR" )
HB_SetCodePage( "FRWIN" )

Regarding ADS, I understand that we can configure Language (Character Set) on the Server. I do not remember much now.
Regards

G. N. Rao.
Hyderabad, India
User avatar
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

Post by Badara Thiam »

There is no change when i replace "FR" by "FRWIN".. :cry:

My databases are in DOS codepage ASCII
Badara Thiam
http://www.icim.fr
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: UPPER() and IsAlpha() return not reals values in french

Post by nageswaragunupudi »

Just now, I installed French language and keyboard and tested this code:

Code: Select all

   HB_LangSelect("FR")
   HB_SetCodePage("FRWIN")

   c := "èàùé"
   ? c, UPPER( c ), ISALPHA( c )
 
Image

This is working both with Harbour and xHarbour.
Regards

G. N. Rao.
Hyderabad, India
User avatar
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

Post by Badara Thiam »

It is not like Clipper. With Clipper you have "EAUE".
It is a big problem in the indexed lists with alphabetic order... Because "é" is after "z" for example.

Where can i find the list of possible parameters for HB_SetCodePage() please ?
Badara Thiam
http://www.icim.fr
User avatar
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

Post by Badara Thiam »

I think that accented characters returned by the UPPER() function of [x]Harbour, is not a good idea.. :mrgreen:
With that, impossible to have a list in alphabetic order.
Badara Thiam
http://www.icim.fr
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: UPPER() and IsAlpha() return not reals values in french

Post by nageswaragunupudi »

It is not like Clipper. With Clipper you have "EAUE".
Clipper is not correct. (x)Harbour is correct.

Code: Select all

It is a big problem in the indexed lists with alphabetic order... Because "é" is after "z" for example.
 
(x)Harbour is expected to adopt the collation rules of the codepage set. If the order is not correct, it is desirable to discuss the issue in (x)Harbour forums.
Anyway please try USING the DBF with CODEPAGE clause.
Regards

G. N. Rao.
Hyderabad, India
User avatar
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

Post by Badara Thiam »

UPPER() with Clipper help also to eliminate accent. [x]Harbour do not make this. This is a important difference. With Clipper we have correct alphabetic lists, with [x]Harbour no. Clipper was more correct. [x]Harbour developpers must make Upper() working like Clipper, and create a new function to return Upper case with accents. The new function could be named UpperReal() for example... But UPPER() is the only one accepted in ADS keys to do what Clipper Upper() do very well. Not [x]Harbour.
Badara Thiam
http://www.icim.fr
User avatar
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

Post by Badara Thiam »

I have posted a message in xHarbour forum here : https://groups.google.com/forum/#!topic ... ZDXRiQpoP8
Badara Thiam
http://www.icim.fr
Post Reply