SQLite

View Ticket
Login
2013-03-20
12:45 Fixed ticket [689137af]: Casting UTF16 to numeric types fails plus 6 other changes (artifact: f98188eb user: drh)
12:04
Fix text-to-numeric type casting so that it works correctly on UTF16 strings that contain characters where the LSB is numeric but the MSB is non-zero. Ticket [689137afb6da41] (check-in: 5b22053f user: drh tags: trunk)
11:08 New ticket [689137af] Casting UTF16 to numeric types fails. (artifact: 4c66baf3 user: drh)

Ticket Hash: 689137afb6da41d0cd61de223d39fa3d5ae41dcb
Title: Casting UTF16 to numeric types fails
Status: Fixed Type: Code_Defect
Severity: Important Priority: Immediate
Subsystem: Unknown Resolution: Fixed
Last Modified: 2013-03-20 12:45:58
Version Found In:
User Comments:
drh added on 2013-03-20 11:08:39:

The second SELECT in the following code returns 34. The correct answer is 3, the same as the first SELECT.

PRAGMA encoding=UTF16be;
SELECT CAST('3x' AS int);
SELECT CAST(x'003301340000' AS int);

A similar error occurs for casting to "real".