I have created a user defined function that strips input text from HTML tags, but found that it also destroys Arabic text for some reason.
I thought: maybe the function's logic causes the text to be converted to VARCHAR somewhere, so I made the function very simple.. It takes an NVARCHAR and returns it to the caller.. Here is the function:
CREATE FUNCTION [dbo].[udf_test] (@string NVARCHAR(MAX))
RETURNS NVARCHAR(MAX) AS
begin
return @string
end
then I made a small test:
select dbo.udf_test('إختبار اللغة العربية Testing Arabic ');
the output is:
?????? ????? ??????? Testing Arabic
The output is fine if I do this:
select 'إختبار اللغة العربية Testing Arabic ';
Why does that happen?