FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour UPPER() and IsAlpha() return not reals values in french
Posts: 160
Joined: Tue Oct 18, 2005 10:21 AM
UPPER() and IsAlpha() return not reals values in french
Posted: Sun Jun 03, 2018 02:22 PM

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
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: UPPER() and IsAlpha() return not reals values in french
Posted: Sun Jun 03, 2018 02:54 PM

Hi Badara, welcome back!

Can you show a little sample of the problem, please?

EMG

Posts: 160
Joined: Tue Oct 18, 2005 10:21 AM
Re: UPPER() and IsAlpha() return not reals values in french
Posted: Sun Jun 03, 2018 03:21 PM
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 (fw): Select all Collapse
****************
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)
Badara Thiam
http://www.icim.fr
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: UPPER() and IsAlpha() return not reals values in french
Posted: Sun Jun 03, 2018 03:27 PM
Please try something simpler like:

Code (fw): Select all Collapse
? UPPER( "x" )


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

EMG
Posts: 160
Joined: Tue Oct 18, 2005 10:21 AM
Re: UPPER() and IsAlpha() return not reals values in french
Posted: Sun Jun 03, 2018 03:35 PM

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

Do you want the complete list of char impacted in french ?

Badara Thiam
http://www.icim.fr
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: UPPER() and IsAlpha() return not reals values in french
Posted: Sun Jun 03, 2018 03:36 PM

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
Posts: 160
Joined: Tue Oct 18, 2005 10:21 AM
Re: UPPER() and IsAlpha() return not reals values in french
Posted: Sun Jun 03, 2018 03:42 PM

Hi Nageswaragunupudi,

This is in my code :

HB_LangSelect("FR")
HB_SetCodePage("FR")
SET(_SET_LANGUAGE, "FR")

Badara Thiam
http://www.icim.fr
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: UPPER() and IsAlpha() return not reals values in french
Posted: Sun Jun 03, 2018 03:50 PM
This is a test with German language
Code (fw): Select all Collapse
   HB_LangSelect("DE")
   HB_SetCodePage("DEWIN")

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




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
Posts: 160
Joined: Tue Oct 18, 2005 10:21 AM
Re: UPPER() and IsAlpha() return not reals values in french
Posted: Sun Jun 03, 2018 04:02 PM

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

My databases are in DOS codepage ASCII

Badara Thiam
http://www.icim.fr
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: UPPER() and IsAlpha() return not reals values in french
Posted: Sun Jun 03, 2018 04:07 PM
Just now, I installed French language and keyboard and tested this code:
Code (fw): Select all Collapse
   HB_LangSelect("FR")
   HB_SetCodePage("FRWIN")

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




This is working both with Harbour and xHarbour.
Regards



G. N. Rao.

Hyderabad, India
Posts: 160
Joined: Tue Oct 18, 2005 10:21 AM
Re: UPPER() and IsAlpha() return not reals values in french
Posted: Sun Jun 03, 2018 04:16 PM

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
Posts: 160
Joined: Tue Oct 18, 2005 10:21 AM
Re: UPPER() and IsAlpha() return not reals values in french
Posted: Sun Jun 03, 2018 04:52 PM

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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: UPPER() and IsAlpha() return not reals values in french
Posted: Sun Jun 03, 2018 05:02 PM

It is not like Clipper. With Clipper you have "EAUE".

Clipper is not correct. (x)Harbour is correct.
Code (fw): Select all Collapse
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
Posts: 160
Joined: Tue Oct 18, 2005 10:21 AM
Re: UPPER() and IsAlpha() return not reals values in french
Posted: Sun Jun 03, 2018 05:24 PM

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
Posts: 160
Joined: Tue Oct 18, 2005 10:21 AM
Re: UPPER() and IsAlpha() return not reals values in french
Posted: Sun Jun 03, 2018 09:01 PM

I have posted a message in xHarbour forum here : https://groups.google.com/forum/#!topic ... ZDXRiQpoP8

Badara Thiam
http://www.icim.fr