Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

accent sequence problem

Status
Not open for further replies.

nzoli

Programmer
Feb 17, 2011
22
0
0
HU
Hi!

I'm using VFP9, and I from Hungary! We are using a lot of accents in our databases. I'm using the collate parameters, to rearrange my database correctly (in the default status, our accents are always at the bottom of our database)
The program displays the accents correctly, but when I hit the "é" letter in the searching box, it is jumping to the first 'e' or 'é' letter depending on which is the first.

Looks like the 'e' and 'é' letters are equal in the script! Same results for other accents like "ö,ü,ó,ő,ú,é,á,ű,í"!

Do you have any idea, how can I solve that? I would like to search correctly to my accents!

Sorry for my english, I hope you understand my question!

best Regards
Zoltan
 
Hi Zoltan,

Yes, your question is perfectly clear - apart from one point:

What do you mean by the "search box"? Do you mean you are using a combo box with incremental search? Or a text box with auto complete? Or what?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Thanx your reply!

I'm searching with grid box!

I made a screenshot! :)
Link

So as you can see the first name is begining with 'Á' and not A beacuse of the second letter 'b'.
I want that the 'A' letter be the first and than the 'Á' letter be the second letter!

thanx!!!
 
Zoltan,

I understand the problem. But the grid in your picture appears to be a custom control of some kind. This kind of incremental search is not native to the grid. You (or someone else) must have added some code to make it work.

Can you show us the code that actually does the searching?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
How do you populate the grid?
In what codepage is the table?
Have you created an inde with "HUNGARY" collation sequence?

This sorts correctly:
Code:
Create Cursor curAccents codepage=1250 (cAccent C(1)) 
For nCount = 1 to 40
   Insert into curAccents Values (Icase(Rand()>.3,'Á',Rand()>.6,'A','B'))
Endfor
Index on cAccent Tag xmachine COLLATE "MACHINE"
Index on cAccent Tag xhungary COLLATE "HUNGARY"
BROWSE
A is sorted first, then Á, then B.

SET ORDER TO xMachine
Now A is first, B second and Á third.

If your grid is populated by a cursor generated by a SQL query, SET COLLATE is important AND also an Index with that collation sequence is important to sort that way. Just one of both things does not give you the wanted order, see


Both ORDER BY lastname have different results because of the currently set collation sequence, but also because of the two indexes. Eg without the index in GENERAL collation sequence the order by would also order in MACHINE order, even if SET COLLATE "GENERAL" is done.

Bye, Olaf.
 
Hi all!

Thanks for your answer!

Mike:
I think I made a fault with my question!
My search is working perfectly!
I have problem only with ordreing the accents and the letters!
Sorry!
-------------
Olaf:

My codepage is: 1250
-------------
I'm using the "INDEX on nev1 TO temp COLLATE "hungary"" order to index my data

I share with you a sample dbf with some testing data!
sample dbf

So!
Please order my sample database with full of my accents!
Our order of accents this: a,á,e,é,i,í,o,ó,ö,ő,u,ú,ü,ű

thanks all of your answer!
Nzoli
 
My search is working perfectly!
I have problem only with ordreing the accents and the letters!

But what I am saying is that trhe problem (with the accents) lies in the code that does the search. In order to solve that problem, we need to see the code.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
It's fine you indexed your data, but you also have to use that index in sorting.

We need to see how you search and what you display. If you query and ORDER BY, SET COLLATION is important, aside of the index being in that collation sequence. Because it's NOT used for sorting, if it's collation does not match the currently set collation and instead SQL sorts by the "MACHINE" ascii codes.

That's what I already showed.

The easiest way to sort your data in collation sequence with your index is SET ODER TO TAG ... with the index tag, which is in HUNGARY collation.

Bye, Olaf.
 
Ok!

I will send you the codes, but I'm only the "postman" between you and the programmer :) (he doesn't speak the english)
Today he is not here, but tomorrow I will send you that codes!

Thanks again, you are very helpful!

nzoli
 
Hi All!

Sorry for my late respond!

I attach my dbf file with sample datas!
sample
Please order my data considering to my accents.

Here is my source code:

Code:
close all database
set exclusive on
set talk off
use sample 
index on name tag name of sample collate "HUNGARY"
go top
brow
close all database

Thanks!
 
You have to add the CDX, too. A table is at least the DBF, then FPT and CDX, if they exist.

And you don't give us, what's not working, you're not giving use the form and control you use and whatever code is working in there.

Bye, Olaf.
 
Yes you are right! Please forgive me, I confuse something I think!
We have some misunderstanding!

I told your request to the programmer, and he told me that:

The problem is simple:
He don't want to search or something, he only want to arrange a dbf file correctly, according to our ascend (a,á,e,é,i,í,o,ó,ö,ő,u,ú,ü,ű)!

Sorry this was my fault!
Thanks for your patient!


 
Well, with HUNGARY collation sequence it is ordered correctly, as far as I see. You said the problem is in incrementally searching in a grid.

Just do this and you see a is sorted before á, after the index is created:

Code:
Create Cursor curTest codepage = 1250 (cText C(1))
Insert into curTest Values ('á')
Insert into curTest Values ('a')
Insert into curTest Values ('í')
Insert into curTest Values ('e')
Insert into curTest Values ('i')
Insert into curTest Values ('é')
Index on cText tag xORder collate "HUNGARY"
BROWSE

This shows a before á, e before é and i before í, so it should work all right in any case. If you don't see the wanted order in a form/list/grid, whatever, then you haven't SET ORDER correctly, or your table isn't in codepage 1250, but then creating an index with HUNGARY collation will lead to errors.

If that was the problem, that was easy. Perhaps your developer should come here to clarify the problem is solved or differs.

Bye, Olaf.
 
Thanks for your reply!

He used the code for these datas:

Code:
CLOSE ALL database
Create Cursor curTest codepage = 1250 (cText C(20))

Insert into curTest Values ('Ábrahám Gábor')
Insert into curTest Values ('Antal György')
Insert into curTest Values ('Aébert')
Insert into curTest Values ('Áántal György')
Insert into curTest Values ('Éaltes Mátyás')
Insert into curTest Values ('Eéemes Áron')
Insert into curTest Values ('Italma')
Insert into curTest Values ('Íalma')
Insert into curTest Values ('Odön')
Insert into curTest Values ('Öadön')

Index on cText tag xORder collate "HUNGARY"
BROWSE

The result was interesting!
If he used only 1 letter, the ordering was perfect as you told, but if he used the records above that was the results:

Code:
Áántal György       
Ábrahám Gábor       
Aébert              
Antal György        
Éaltes Mátyás       
Eéemes Áron         
Íalma               
Italma              
Öadön               
Odön


The "Áántal György" is in the first place instead of Antal György!
It seems the second letter confuse the ordering!
 
I found something even I didn't know before:

There is a "National Language Support" (NLS) list. Codepages included are sorted and compared correctly. Codepage 1250 is not among these code pages.

SYS(2300) - Add or Remove Code Page

I did call =SYS(2300,1250,1) as suggested by the help topic and then reindexed the cursor, still the ordering is wrong. I also restartet and redid the whole code after the SYS(2300) call. That's strange indeed. I fear I can't help you any further, if that doesn't help you. Your situation differs a bit from mine, as you might have a config.fpw with CODEPAGE = 1250 and generally work in that code page. My VFP IDE code page setting still defaults to 1252 and that might also have an effect, as the current code page differs from the table codepage and the current (general) collation differs from the index collation. IIRC these collations only work right, when both are the same. So start your VFP IDE with config.fpw having that code page defined and then try again.

Bye, Olaf.
 
Thanks for your help!

Yes it is still not working :(


thanks again for your patient!
 
Shortly: The alphabetical order is correct in the above example. Please look at a Hungarian-English dictionary.
Sándor - Hungary
 
Dear Sandor!

Can we speak in hungarian?
thanks!
 
Hi nzoli

Please have a look at
[2 Aug 2007 2:42] Gabor Czigola

It is not possible to have a correct Hungarian collation without knowing the meaning of the sorted words, see for example:

CSS < CZAKÓ < CSAK

CSS isn't a word in the Hungarian language, although Czakó is a name, csak means but. More complicated examples are also easy to find. So we won't see a correct Hungarian collation in MySQL (or anywhere else) not involving an AI that knows (at least) Hungarian.

I guess approaches to create 'correct' collations (for example in MSSQL) are misleading, confusing and a nest of bugs for programs relying on sorted results.

hth

MarK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top