On Wed, 05 Nov 2008, Mindaugas Kavaliauskas wrote:
Hi Mindaugas,
> Well, I did not know such things. After such know knowledge I'll be afraid
> to use ==. Perhaps, I'll write my own string_[binary_]equal() :)
If you do not use CP which can introduce equal chars then you do not
have to think about such problem.
BTW I also do not like it and I changed original CDP code to never
return that strings are equal when == is used and strings are binary
different. So now we do not have such problem as long as my hack exists.
> I really do not know what is the best solution in this case, but I see
> binary comparison most natural.
But it cannot be used for hashes when CASEMATCH is disabled.
In such situation we have to use use functions which operate on
national characters to check which values in binary data are
letters for given language what makes hash array internals
CDP dependent. We can reduce the problem by storing modified
(hashed) keys when CASEMATCH is enabled so at least internal
representation will be always the same. The side effect is
that we will not be able to return original key value, f.e.:
h := hb_hSetCastMatch( {=>}, .F. )
h[ "Mindaugas" ] := "Kavaliauskas"
for each v in h
? v:__enumKey(), v
next
will show:
MINDAUGAS Kavaliauskas
but I think it's worth to pay. If other developers will agree
with me then I'll change internal hash representation so keys
will be hashed when added and then always sorted in binary form.
best regards,
Przemek
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour