On 07/06/2013 11:56, Leyne, Sean wrote: > >> similar to does not match x'##'-codes >> ------------------------------------- >> >> Key: CORE-4114 >> URL: http://tracker.firebirdsql.org/browse/CORE-4114 >> Project: Firebird Core >> Issue Type: Bug >> Components: Engine >> Affects Versions: 2.5.2 >> Environment: Win7/64 >> Reporter: Thomas Beckmann >> >> >> As this example points out, x'##'-codes are not properly matched by similar >> to: >> >> select >> iif(' ' similar to '[[:WHITESPACE:]]', 'T', 'F'), >> iif(x'20' similar to '[[:WHITESPACE:]]', 'T', 'F'), >> iif(x'20' similar to '%', 'T', 'F') >> from RDB$DATABASE >> >> returns 'T', 'F', 'F' > In a comment, Vlad Khorsun wrote: > > Thomas, > > x-prefixed literals have charset OCTETS and it could be a reason for > such issues. > > Try to use charset introducer before literal, for example: _win1252 > x'20' > > The problem is different!
Pattern matching (not only SIMILAR, but LIKE too, for example) converts the special characters (say '%', '_') from unicode to the matcher charset. When the conversion is done from unicode to octets, the result byte is prefixed with 0x00 (as its unicode representation). I believe in this case, the "conversion" must be done from ASCII. Adriano ------------------------------------------------------------------------------ How ServiceNow helps IT people transform IT departments: 1. A cloud service to automate IT design, transition and operations 2. Dashboards that offer high-level views of enterprise services 3. A single system of record for all IT processes http://p.sf.net/sfu/servicenow-d2d-j Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel
