I am making a Library Management System, I am trying to add arabic support in my project but I am facing difficulties as follows,
when inserting data in SQL through Query i.e Insert into book_info values(25, N'جاوا', N'Author',N'Publisher',2014,N'Subject',50,N'Language','Latest',5)
The List of Columns in book_info is as follows
Therefore when I execute this query through my Project, SQL Management Studio
Shows some Encoded Characters like 'مجتبیٰ'
in place of Arabic Characters, and not only in SQL Management Studio
but also when Selecting data in project. Note: these values in query are taken from textfield
through .getText()
function
What if we just skip the first problem by executing the query in SQL Management Studio
, by doing this the first problem is temporarily resolved as SQL Management Studio
is showing arabic characters when selecting the data but again when we select it from our software and show it in Textfield
by Getting data from ResultSet
like "TextF.setText(ResultS.getNString())
" it shows "??????
" in the text field in place of Arabic Characters.
Your database definition, query, and SQL instance is fine. The issue you are having is with reading the string from the database into java.
I think Java is trying to read your nvarchar text as ASCII characters, when they are actually in Unicode. The result is garbled looking text. I think when you read the text from the database, you'll need to ensure you're reading as Unicode.
If you can post your code, I could probably pinpoint what is causing you issues.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With