"String" strange behaviour ?

can anyone shed some light on what I am doing (obviously) wrong?
This excerpt of code is inside a URL handler of Tim Dietrichs exceptionally well designed Allow Express Framework. Although I think that is is not important that it runs in such a REST server environment.
The function retrieves data from a database and display the data on a web site. The search pattern for the data is coming in through Request.URLParams and FetchBOM is doing the database query.
But rs is always empty ! When using the very same query string “hard coded” it works! Even if I do this stupid comparison you see i the code.
Any idea ?

 // Dynamically generate a response.
  dim nav as new NavDBEngine.navDB
  dim rs as RecordSet
  dim stkStr as String = Request.URLParams
  dim stkStr2 as String = "EL 40 926"
  stkStr = stkStr.ReplaceAll("%20"," ")
  if stkStr=stkStr2 then
    rs = nav.FetchBOM(stkStr2)   'Retrieves all records. Works as expected
    'rs = nav.FetchBOM(stkStr)    'returns an empty rs. Why ?
  end if


Xojo 2018R11
macOS 10.13.5

Try adding the following before the if


Are both values the same?

Jun 27 08:54:19 servs.debug[2018] : 454C20343020393236
Jun 27 08:54:19 servs.debug[2018] : 454C20343020393236

both values are exactly the same (as it was show in the debugger before). This is really strange.

what are the encoding? you can see them in the debugger

Hi Antonio,
thanks for the hint! I did not expect that the two strings have different encodings.
In fact
stkStr Encoding is Nil
stkStr2 encoding is UTF8
setting strStr encoding to UTF8 solves the mystery.

stkStr = stkStr.DefineEncoding(Encodings.UTF8)

String, Text, Encoding - always confusing.

Maybe this will help: