Problem matching 2 strings

Do sTestLodgeID = rsGrandLodges.Field("pkGrandLodgeID").StringValue if sTestLodgeID = sGrandLodgeID then Exit else rsGrandLodges.MoveNext end if Loop Until rsGrandLodges.EoF

The above code is in a method called from the double-click event of a listbox. The sGrandLodgeID parameter is passed as a string.
When looping, the debug box shows sTestLodgeID as 2 and the sGrandLodgeID as 2 yet the equality test fails. On further examination, the sTestLodgeID is encoded as US-ASCII and the sGrandLodgeID as UTF-8. I dimensioned them both as STRING.

Can someone please tell me why 2 and 2 don’t match.

thanks

I can’t reproduce your results. Are you sure there aren’t some extra bytes in one of those values?

Shouldn’t be but you give me the idea to strip it down… I’ll give that a shot.

thanks

Okay, I would consider this a bug in Xojo. The problem was that in the method definition, I had the incoming parameter sGrandLodgeID misspelled as sGraqndLodgeID.

Didn’t get an error that said sGrandLodge was undefined. Corrected the spelling and it worked fine.

[quote=273128:@william plunkett]Okay, I would consider this a bug in Xojo. The problem was that in the method definition, I had the incoming parameter sGrandLodgeID misspelled as sGraqndLodgeID.

Didn’t get an error that said sGrandLodge was undefined. Corrected the spelling and it worked fine.[/quote]
That’s weird. Did you define sGrandLodgeID as a property (rather than a method parameter) - Xojo wouldn’t throw an error then and it would get you to the point where things wouldn’t work.

There must be a method or property with the same name. You cannot compile Xojo with an undefined variable like you can in other languages.

it was defined as a method parameter but there was also a property with the same name.

my bad - just sloppy coding

Xojo works on Utf8 try this…

 Do
    sTestLodgeID = rsGrandLodges.Field("pkGrandLodgeID").StringValue.ConvertEncoding(UTF8) 
    if sTestLodgeID = sGrandLodgeID then
      Exit
    else
      rsGrandLodges.MoveNext
    end if
  Loop Until rsGrandLodges.EoF

Or is possible change entire database character set for not have problem…