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

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

Postby Badara Thiam » Sun Jun 03, 2018 2: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
User avatar
Badara Thiam
 
Posts: 160
Joined: Tue Oct 18, 2005 10:21 am
Location: France

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

Postby Enrico Maria Giordano » Sun Jun 03, 2018 2:54 pm

Hi Badara, welcome back!

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

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8719
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

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

Postby Badara Thiam » Sun Jun 03, 2018 3: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: Select all  Expand view  RUN

****************
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
Badara Thiam
 
Posts: 160
Joined: Tue Oct 18, 2005 10:21 am
Location: France

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

Postby Enrico Maria Giordano » Sun Jun 03, 2018 3:27 pm

Please try something simpler like:

Code: Select all  Expand view  RUN
? UPPER( "x" )


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

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8719
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

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

Postby Badara Thiam » Sun Jun 03, 2018 3:35 pm

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
Badara Thiam
 
Posts: 160
Joined: Tue Oct 18, 2005 10:21 am
Location: France

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

Postby nageswaragunupudi » Sun Jun 03, 2018 3: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
User avatar
nageswaragunupudi
 
Posts: 10662
Joined: Sun Nov 19, 2006 5:22 am
Location: India

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

Postby Badara Thiam » Sun Jun 03, 2018 3: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
User avatar
Badara Thiam
 
Posts: 160
Joined: Tue Oct 18, 2005 10:21 am
Location: France

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

Postby nageswaragunupudi » Sun Jun 03, 2018 3:50 pm

This is a test with German language
Code: Select all  Expand view  RUN
  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
nageswaragunupudi
 
Posts: 10662
Joined: Sun Nov 19, 2006 5:22 am
Location: India

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

Postby Badara Thiam » Sun Jun 03, 2018 4: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
User avatar
Badara Thiam
 
Posts: 160
Joined: Tue Oct 18, 2005 10:21 am
Location: France

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

Postby nageswaragunupudi » Sun Jun 03, 2018 4:07 pm

Just now, I installed French language and keyboard and tested this code:
Code: Select all  Expand view  RUN
  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
nageswaragunupudi
 
Posts: 10662
Joined: Sun Nov 19, 2006 5:22 am
Location: India

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

Postby Badara Thiam » Sun Jun 03, 2018 4: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
User avatar
Badara Thiam
 
Posts: 160
Joined: Tue Oct 18, 2005 10:21 am
Location: France

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

Postby Badara Thiam » Sun Jun 03, 2018 4: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
User avatar
Badara Thiam
 
Posts: 160
Joined: Tue Oct 18, 2005 10:21 am
Location: France

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

Postby nageswaragunupudi » Sun Jun 03, 2018 5:02 pm

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

Clipper is not correct. (x)Harbour is correct.
Code: Select all  Expand view  RUN

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
nageswaragunupudi
 
Posts: 10662
Joined: Sun Nov 19, 2006 5:22 am
Location: India

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

Postby Badara Thiam » Sun Jun 03, 2018 5: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
User avatar
Badara Thiam
 
Posts: 160
Joined: Tue Oct 18, 2005 10:21 am
Location: France

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

Postby Badara Thiam » Sun Jun 03, 2018 9:01 pm

I have posted a message in xHarbour forum here : https://groups.google.com/forum/#!topic ... ZDXRiQpoP8
Badara Thiam
http://www.icim.fr
User avatar
Badara Thiam
 
Posts: 160
Joined: Tue Oct 18, 2005 10:21 am
Location: France

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 52 guests