Insert to Sql server

Posted on 2003-03-08
Medium Priority
Last Modified: 2006-11-17
I have been used charset=Windows-1256 but my data seems like ?????.
How can i Insert Arabic charset into Sql server with Java servlet or jsp?
I need imeddiate help.
Question by:reza_rahmati
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 14

Accepted Solution

kennethxu earned 200 total points
ID: 8093892
I would suggest you to use utf-8 if you have choice, and in your jsp/servlet, make sure you follow this guideline:

1st part:
in every jsp page you need:
<%@ page contentType="text/html; charset=UTF-8" %>
in every html page you need this line in your html <head>:

2nd part:
if your server supports servlet 2.3, use:
request.setCharacterEncoding( "UTF-8" );
before you use any request.getParameter call.

if your server doesn't support 2.3, use this:

String encoding = request.getCharacterEncoding();
if( encoding == null ) encoding = "ISO-8859-1";
String myString = request.getParameter( "xxx" );
if( myString != null ) myString = new String( myString.getBytes( encoding ), "UTF-8" );

if you must use windows-1256, you need to replade "UTF-8" with "Windows-1256" in the 1st part of my code, and use "Cp1256" in the 2nd part of my code.

LVL 35

Expert Comment

ID: 10041000
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- Points to kennethxu

Please leave any comments here within the next seven days.


EE Cleanup Volunteer

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An introduction to the wonderful sport of Scam Baiting.  Learn how to help fight scammers by beating them at their own game. This great pass time helps the world, while providing an endless source of entertainment. Enjoy!
Check out the latest tech news, community articles, and expert highlights in August's newsletter.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month8 days, 6 hours left to enroll

766 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question