?
Solved

Insert to Sql server

Posted on 2003-03-08
3
Medium Priority
?
280 Views
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.
0
Comment
Question by:reza_rahmati
2 Comments
 
LVL 14

Accepted Solution

by:
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>:
<META HTTP-EQUIV="CONTENT-TYPE"CONTENT="TEXT/HTML;CHARSET=UTF-8">

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.

HTH
0
 
LVL 35

Expert Comment

by:girionis
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.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

girionis
EE Cleanup Volunteer
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Don’ts and Dos are two important end products of software testing basics that a tester needs to regard. This article attempts to explain the principles of both.
Whether you have a site with just static html pages or a dynamic database-driven one, this step-by-step migration guide will help you get started with your new DV server. This guide is by no means comprehensive but it should cover the basics to get …
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…
Suggested Courses

621 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