Unicode with MSSQL
Describe the bug
Wren SQL fails to handle Unicode Vietnamese keyword searches using the LIKE clause. Specifically, I am trying to search for Vietnamese job titles using LIKE LOWER('%Dự toán viên%').
- Without the
Nprefix before the Unicode string, the query runs but returns no result, even though data clearly exists (verified via SQL Server Management Studio). - When I add the
Nprefix (e.g.LIKE LOWER(N'%Dự toán viên%')), I get a SQL syntax error from Wren.
This is blocking international users from querying properly localized data.
To Reproduce Steps to reproduce the behavior:
-
Use Wren SQL UI
-
Input the SQL as shown:
SELECT "dbo_PUB_HRM_Officer"."EmployeeId" AS "EmployeeId", "dbo_PUB_HRM_Officer"."DisplayName" AS "DisplayName", "dbo_PUB_HRM_Officer"."Email" AS "Email", "dbo_PUB_HRM_Officer"."DepartmentVI" AS "DepartmentVI", "dbo_PUB_HRM_Officer"."JobTitleVI" AS "JobTitleVI" FROM "dbo_PUB_HRM_Officer" AS "dbo_PUB_HRM_Officer" WHERE LOWER("dbo_PUB_HRM_Officer"."JobTitleVI") LIKE LOWER(N'%Dự toán viên%') -
Click on
Preview data -
Observe the error or empty result set depending on usage of
N.
Expected behavior
The SQL engine should properly handle N-prefixed Unicode strings and allow localized full-text search in languages like Vietnamese.
Screenshots Included below:
-
Screenshot 1: No result if
Nprefix is not used. -
Screenshot 2: SQL syntax error if
Nprefix is used.
Desktop (please complete the following information):
- OS: Windows 11
- Browser: Chrome (v124.0)
Wren AI Information
- Version: 0.22.2 (from public Docker deployment)
Additional context
The SQL runs as expected in SQL Server Management Studio. Issue appears to stem from Wren SQL parser not supporting N'' syntax correctly or misinterpreting Unicode input.