You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And we see the following output
ISMATCH HASH1 HASH2
-------------------------------------
TRUE 246225519 547439
Also exhibits similar behaviour when using different client connection character sets and evaluating a static value, e.g.
SELECT HASH('€URO') FROM RDB$DATABASE;
isql -ch WIN1252....
HASH = 547439
isql -ch UTF8 ...
HASH = 246225519
I guess that the solution would be to ensure that the HASH always converts text strings (or blob strings) to UTF8 before evaluating, although that would likely break existing systems that are expecting it to work the way that it does now...
The text was updated successfully, but these errors were encountered:
Submitted by: Mark Jones (mjnz)
Using a different character set changes the resulting HASH value for the same string
CREATE TABLE TEST (
TESTSTR1 VARCHAR(20) CHARACTER SET UTF8,
TESTSTR2 VARCHAR(20) CHARACTER SET WIN1252 );
INSERT INTO TEST (TESTSTR1, TESTSTR2) VALUES ('€URO','€URO');
SELECT
IIF(TESTSTR1 = TESTSTR2,'TRUE','FALSE') ISMATCH,
HASH(TESTSTR1) HASH1,
HASH(TESTSTR2) HASH2 FROM TEST;
And we see the following output
ISMATCH HASH1 HASH2
-------------------------------------
TRUE 246225519 547439
Also exhibits similar behaviour when using different client connection character sets and evaluating a static value, e.g.
SELECT HASH('€URO') FROM RDB$DATABASE;
isql -ch WIN1252....
HASH = 547439
isql -ch UTF8 ...
HASH = 246225519
I guess that the solution would be to ensure that the HASH always converts text strings (or blob strings) to UTF8 before evaluating, although that would likely break existing systems that are expecting it to work the way that it does now...
The text was updated successfully, but these errors were encountered: