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
I noticed that there's a problem with Persian/Arabic characters when using .input().
Note
Both ی (Persian) and ي (Arabic) represent the ~same character but with different unicodes.
In my database, since there isn't strict formatting rules, both forms exist; for example, both 'شادی' and 'شادي' are possible and acceptable values.
When I directly write the value in my query, it works as desired and both values return data.
// ✅ Worksdata=awaitpool.request().query(`select Name as first_name from People where Name = 'شادی'`);
// ✅ Worksdata=awaitpool.request().query(`select Name as first_name from People where Name = 'شادي'`);
Using JS variables works too:
// ✅ WorksconstPERSIAN='شادی';data=awaitpool.request().query(`select Name as first_name from People where Name = '${PERSIAN}'`);
// ✅ WorksconstARABIC='شادي';data=awaitpool.request().query(`select Name as first_name from People where Name = '${ARABIC}'`);
But when I use input() to utilize sql variables, only the Arabic text works:
// ✅ Worksdata=awaitpool.request().input('nameVar',NVarChar(20),'شادي').query(`select Name as first_name from People where Name = @nameVar`);
// 🔴 Doesn't Workdata=awaitpool.request().input('nameVar',NVarChar(20),'شادی').query(`select Name as first_name from People where Name = @nameVar`);
Seem like there's an issue with input() and how it passes data to query, because using variables with both values work in sql (direct query)
-- ✅ Works
declare @nameVar nvarchar(20) ='شادی'select
name
from
people
where
name = @nameVar
-- ✅ Works
declare @nameVar nvarchar(20) ='شادي'select
name
from
people
where
name = @nameVar
Expected behaviour:
input() should behave like direct queries and don't change characters or anything.
I noticed that there's a problem with Persian/Arabic characters when using
.input().Note
Both
ی(Persian) andي(Arabic) represent the ~same character but with different unicodes.In my database, since there isn't strict formatting rules, both forms exist; for example, both 'شادی' and 'شادي' are possible and acceptable values.
When I directly write the value in my query, it works as desired and both values return data.
Using JS variables works too:
But when I use
input()to utilize sql variables, only the Arabic text works:Seem like there's an issue with
input()and how it passes data toquery, because using variables with both values work in sql (direct query)Expected behaviour:
input()should behave like direct queries and don't change characters or anything.Software versions