Procedure for Converting Arabic text to UTF-8format

  • Hi Folks,

    By default , am sending English SMS as soon as i enter the data into a table using Windows Service. But now , i need to send the SMS in Arabic , so when am trying to send it ( by making some changes in my stored procedure ) , am receiving some text like 'U??U' ...

    So can anyone help me by guiding me as to how to convert the arabic text to unicode or utf-8 format..

    Thanks in advance..

    Best Regards,
    TALIB ALI KHAN
    MCTS
    http://www.onlineasp.net

  • Are you using NChar/NVarchar for all of the data that's supposed to be that way?

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Hi ,

    Thanks for the reply..

    But the Arabic data is getting displayed perfectly in the DB , only problem is that when i am sending this as an SMS , then its not displaying....

    And help/suggestions are highly welcomed and appreciated....

    Thanks...

    Best Regards,
    TALIB ALI KHAN
    MCTS
    http://www.onlineasp.net

  • Not sure what you mean by it being displayed perfectly in the DB, nor what you mean about sending it to an SMS.

    The DB is just a bunch of storage on a disk. It doesn't display anything. What application are you using when you look at it?

    To me, SMS = SQL Management Studio. I'm probably missing something there. (Probably something obvious, and which I should/do know, but just not making the connection.)

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • By SMS i meant was Short Message Service in Mobile phones .......

    But anyways i have solved the problem by using SQL - CLR Integration feature in VS.NET,

    where by after creating a Database project , we can deploy that project's DLL onto the instance of SQL Server 2005. Then we need to create an ASSEMBLY for that DLL and after that Create either a Stored Proc./ Function that internally calls this assembly....

    But again if you have any idea of converting the arabic text to unicode , then please suggest it to me....

    Thanks for your valuable reply....

    Best Regards,
    TALIB ALI KHAN
    MCTS
    http://www.onlineasp.net

  • As I go "duh" for forgetting what SMS is... yeah, a CLR proc is the way I'd go on that one too.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Hi Talib,

    1. Take care to prefix the non-english strings with N as explained in the below link from the Microsoft support

    http://support.microsoft.com/kb/239530

    You must precede all Unicode strings with a prefix N when you deal with Unicode string constants in SQL Server

    For example

    CREATE TABLE [dbo].[Emp](

    [EmpNo] [int],

    [EmpName] [nvarchar](70))

    INSERT INTO [dbo].[Emp] VALUES

    (1, '????')

    INSERT INTO [dbo].[Emp] VALUES

    (2, N'????')

    SELECT * FROM [dbo].[Emp]

    EmpNoEmpName

    1????

    2????

    Similarly, while fetching data from the SQL Server the field name should be preceded with 'N' to convert it to unicode as follows

    SELECT N''+EmpName from [dbo].[Emp] where EmpNo = 2

    2. Also take care to define proper collation for the nchar/nvarchar fields in the database.

    -----------------------------------------------------------[font=Arial Black]Time Is Money[/font][font=Arial Narrow]Calculating the Number of Business Hours Passed since a Point of Time[/url][/font][font=Arial Narrow]Calculating the Number of Business Hours Passed Between Two Points of Time[/font]

  • Hi Mazhar,

    Thanks for your concern and yeah ... i know what you have specified in your post.

    But as you can see in my last post .... i have solved the problem by using SQL-CLR Integration ...

    But again a big thanks for your concern....

    Best Regards,
    TALIB ALI KHAN
    MCTS
    http://www.onlineasp.net

  • Hi Talib,

    yeah I know that your problem was solved. I just added my comments as you asked

    But again if you have any idea of converting the arabic text to unicode , then please suggest it to me....

    Now let us know more about how did you solve it 🙂

    But anyways i have solved the problem by using SQL - CLR Integration feature in VS.NET,

    where by after creating a Database project , we can deploy that project's DLL onto the instance of SQL Server 2005. Then we need to create an ASSEMBLY for that DLL

    Post the scripts of the Database project that you created and the objects involved with some sample data.

    Thanks in advance.

    -----------------------------------------------------------[font=Arial Black]Time Is Money[/font][font=Arial Narrow]Calculating the Number of Business Hours Passed since a Point of Time[/url][/font][font=Arial Narrow]Calculating the Number of Business Hours Passed Between Two Points of Time[/font]

Viewing 9 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply