Page 1 of 2

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

Posted: Sun Jun 03, 2018 2:22 pm
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 ?

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

Posted: Sun Jun 03, 2018 2:54 pm
by Enrico Maria Giordano
Hi Badara, welcome back!

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

EMG

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

Posted: Sun Jun 03, 2018 3:21 pm
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) 
 

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

Posted: Sun Jun 03, 2018 3:27 pm
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

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

Posted: Sun Jun 03, 2018 3:35 pm
by Badara Thiam
Example : Upper("é"), Upper("è") or Upper("ê") must return "E"

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

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

Posted: Sun Jun 03, 2018 3:36 pm
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

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

Posted: Sun Jun 03, 2018 3:42 pm
by Badara Thiam
Hi Nageswaragunupudi,

This is in my code :

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

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

Posted: Sun Jun 03, 2018 3:50 pm
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.

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

Posted: Sun Jun 03, 2018 4:02 pm
by Badara Thiam
There is no change when i replace "FR" by "FRWIN".. :cry:

My databases are in DOS codepage ASCII

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

Posted: Sun Jun 03, 2018 4:07 pm
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.

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

Posted: Sun Jun 03, 2018 4:16 pm
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 ?

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

Posted: Sun Jun 03, 2018 4:52 pm
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.

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

Posted: Sun Jun 03, 2018 5:02 pm
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.

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

Posted: Sun Jun 03, 2018 5:24 pm
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.

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

Posted: Sun Jun 03, 2018 9:01 pm
by Badara Thiam
I have posted a message in xHarbour forum here : https://groups.google.com/forum/#!topic ... ZDXRiQpoP8