Home Answers Viewqa JSP-Servlet unicode support in javascript

 
 


ram
unicode support in javascript
2 Answer(s)      4 years and 8 months ago
Posted in : JSP-Servlet

View Answers

October 17, 2008 at 4:18 PM


Hi friend,



Please give the full details and source code to solve the problem.


Thanks

October 17, 2008 at 5:02 PM


We are holding all data in java scripts object , .

Here sample code here,


<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>


//

We have removed server side code from , That is not related with above mentioned problem..
After fetching data from server we displaying in the text field and mpdifying content
content is accumulating junk value in the text field before sending to server functionality


We are already using encodingfor jsp


1)and client side page
<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>

2)
(<meta http-equiv="Content-Type" content="text/html; charset=windows-874" /> (taken from Hutch--check it http://www.hutch.co.th/index_th.htm)

we have alrready tried <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">;
<html xmlns="http://www.w3.org/1999/xhtml">;
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />

<script language="JavaScript" src="common/FormFillValidation.js" type="text/javascript"></script>
<script language="JavaScript" src="common/sortTable.js" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript">
parent.document.frmFill.allUploadCodes.value = '<%=allUploadCodes%>';
parent.document.frmFill.allContentNames.value = '<%=allContentNames%>';
parent.document.frmFill.contentId.value = '<%=contentId%>';


function actorChange(){
var selActor =document.frmBuffer.cmbactors[document.frmBuffer.cmbactors.selectedIndex].value;
if (selActor == -1) {
popitup('popup/NewActor.jsp');}
}
function artistChange(){
var selArtist =document.frmBuffer.cmbartists[document.frmBuffer.cmbartists.selectedIndex].value;
if (selArtist == -1){
popitup('popup/NewArtist.jsp');}
if (selArtist == -2){
window.open('popup/CoArtists.jsp','name','height=400,width=500');
//popitup('popup/CoArtists.jsp');
}
}
function movieChange(){
var selMovie =document.frmBuffer.cmbmovies[document.frmBuffer.cmbmovies.selectedIndex].value;
if (selMovie == -1){
popitup('popup/NewMovie.jsp');}
}
function chkUpdate(chk, len ){
document.frmBuffer.chkValue.value = chk ;
var nchk = eval('document.frmBuffer.chkBufedit'+chk);
var i = 0;
for (i=0 ; i< len ; i++ )
{
if (i != chk ){
nchk = eval('document.frmBuffer.chkBufedit'+i);
if (nchk.checked){
//alert("Releasing other checks");
nchk.click();
}
}
}
}

// validate and add the Content details to the buffer
function add(){
document.frmBuffer.pageType.value = "addVar";
document.frmBuffer.action = "BatchEdit_Bottom.jsp";
document.frmBuffer.submit();

}

//Clears the Buffer
function clearBuff(){
document.frmBuffer.pageType.value = "clrbuf";
document.frmBuffer.action = "BatchEdit_Bottom.jsp";
document.frmBuffer.submit();
}

//Upload the buffer
function uploadBuff(){
if(<%=batchUpdateFlag%> == true){
document.frmBuffer.pageType.value = "batchUpdate";
}
else{
//alert("NEW upload");
document.frmBuffer.pageType.value = "upload";
}
document.frmBuffer.action = "BatchEdit_Bottom.jsp";
document.frmBuffer.submit();
}

function removeTone(){
//code modyfied by .P on 2/7/2007
var cnf="false";
var bsize=document.getElementById("txtbufsize").value;
var h = 0;
for(h=0;h<bsize;h++)
{
if(eval('document.frmBuffer.chkBufedit'+h).checked == true)
{
cnf=true;
}
}
if (cnf==true){
document.frmBuffer.pageType.value = "remove";
document.frmBuffer.action = "BatchEdit_Bottom.jsp";
document.frmBuffer.submit();
}else
{
alert('Please select the checkbox!!');
}
}
function editTone(){
var cnf="false";
var bsize=document.getElementById("txtbufsize").value;
var h = 0;
for(h=0;h<bsize;h++)
{
if(eval('document.frmBuffer.chkBufedit'+h).checked == true)
{
cnf=true;
}
}
if (cnf==true){
document.frmBuffer.pageType.value = "edit";
document.frmBuffer.action = "BatchEdit_Bottom.jsp?txtaddeditvalue=1";
document.frmBuffer.submit();
}else
{
alert('Please select the checkbox!!');
}

}
function updateItem(){

document.frmBuffer.pageType.value = "update";
document.frmBuffer.chkValue.value = '<%=editIndx%>';
//alert( <%=editIndx%> );
document.frmBuffer.action = "BatchEdit_Bottom.jsp";
document.frmBuffer.submit();

}
</script>


</head>
<body onLoad='initTable("tblBuffer");' topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">
<form name="frmBuffer" method="POST" action="">
<input type="hidden" name="chkValue" value="-1">
<input type="hidden" name="pageType" value=" ">
<input type="hidden" name="batchId" value="<%=curBatchId%>">
<input type="hidden" name="uploadDate" value="<%=currentDate%>">
<input type="hidden" name="isUploadcodeUnique" value="false">

<input type="hidden" name="txtbufsize" value="<%=Bufsize%>">
<input type="hidden" name="txtaddeditvalue" value="<%=addeditflag%>">

<div align="center">

<table border="0" width="100%" cellpadding="0" valign="top" cellspacing="0">
<tr>
<td>
<div style="width:100%;">
<table border="0" width="100%" bgcolor="#FAEBD7" ID="tblBuffer">
<tr>
<td bgcolor="#C0C0C0" width="4%"><font style="verdana" size="2"><b>S no.</b></font></td>
<td bgcolor="#C0C0C0" width="10%"><font style="verdana" size="2"><b>Content Id</b></font></td>
<td bgcolor="#C0C0C0" width="13%"><font style="verdana" size="2"><b>Upload Filename</b></font></td>
<td bgcolor="#C0C0C0" width="13%"><font style="verdana" size="2"><b>ContentName</b></font></td>
<td bgcolor="#C0C0C0" width="13%"><font style="verdana" size="2"><b>Movie/Album Name</b></font></td>
<td bgcolor="#C0C0C0" width="13%"><font style="verdana" size="2"><b>Artists</b></font></td>
<td bgcolor="#C0C0C0" width="13%"><font style="verdana" size="2"><b>Content Type</b></font></td>
<td bgcolor="#C0C0C0" width="13%"><font style="verdana" size="2"><b>Song Name</b></font></td>
<td bgcolor="#C0C0C0" width="12%">
<input type="button" value="Edit" onClick="javascript:editTone()" name="btnBufedit" style="border: 2px ridge #FFFFFF; background-color:#C0C0C0; color:#FFFFFF; width:100%; height:20; font-weight:bold">
<bgcolor="#C0C0C0">
<!-- <input type="button" value="Del" onClick="javascript:removeTone()" name="btnBufDelete" style="border: 3px ridge #FFFFFF; background-color:#C0C0C0; color:#FFFFFF; width:45%; height:25; font-weight:bold"> -->
</td>
</tr>
<% if (bufferVec != null){
for (int i=0;i<bufferVec.size();i++)
{
uploaditem tnDtl = (uploaditem) bufferVec.elementAt(i);
String chkClick = "javascript:chkUpdate('"+ i +"','" + bufferVec.size()+"')";
Bufsize=bufferVec.size();

%>
<tr>
<td border="1" width="4%"><font color="#000000"><%=i+1%></font></td>
<td border="1" width="5%"><font color="#000000"><%=tnDtl.toneId%></font></td>
<td border="1" width="5%"><font color="#000000"><%=tnDtl.uploadcode%></font></td>
<td border="1" width="15%"><font color="#000000"><%=tnDtl.toneName%></font></td>
<td width="15%"><font color="#000000"><%=tnDtl.albumName%></font></td>
<td width="15%"><font color="#000000"><%=tnDtl.artistName%></font></td>
<td width="15%"><font color="#000000"><%=tnDtl.toneTypeName%></font></td>
<td width="15%"><font color="#000000"><%=tnDtl.songName%></font></td>

<% if (editFlag == true){
if (i == editIndx ){%>
<td width="12%"><input disabled checked type="checkbox" value="<%=i%>" onClick="<%=chkClick%>" name="chkBufedit<%=i%>"></td>
<%}}else{%>
<td width="12%"><input type="checkbox" value="<%=i%>" onClick="<%=chkClick%>" name="chkBufedit<%=i%>"></td>
<%}%>
</tr>
<%}%>
<%}%>
<tr>
<% if (upStatus == true ){%>
<font color="#FFFFFF"> </font>
<td align="center"><b><font size="4">Content Upload Success</font></b><font size="4"> </font></td>
<script type="text/javascript">
parent.location.href = "AddFiles.jsp";
</script>
<%}%>
<% if (editFlag == true ){%>
<script type="text/javascript">
document.frmBuffer.btnBufedit.disabled = true ;
//document.frmBuffer.btnBufDelete.disabled = true ;
</script>
<%}%>
</tr>
</table>
<%

if(editFlag==true)
{%>
<input type="hidden" name="txtcode" value="<%=editTn.uploadcode%>">
<input type="hidden" name="txttonname" value="<%=editTn.toneName%>">
<input type="hidden" name="cmbmovies" value="<%=editTn.albumId+"|"+editTn.albumName%>">
<input type="hidden" name="cmbartists" value="<%=editTn.artistId+"|"+editTn.artistName%>">
<input type="hidden" name="hdcoArtists" value="<%=editTn.coactorId%>">
<input type="hidden" name="cmbactors" value="<%=editTn.actorId+"|"+editTn.actorName%>">
<input type="hidden" name="terrSubpubStr" value="<%=editTn.terrSubpubString%>">
<input type="hidden" name="cmbtonetype" value="<%=editTn.toneTypeId+"|"+editTn.toneTypeName%>">
<input type ="hidden" name="newcontent" value="0">
<input type="hidden" name="cmbSong" value="<%=editTn.songId+"|"+editTn.songName%>">
<input type="hidden" name="lyrics" value="<%=editTn.songLyrics%>">
<input type="hidden" name="txtsongcode" value="<%=editTn.songCode%>">
<!-- Added by Jay for bringing publisher in Main Page -->
<input type="hidden" name="cmbPublisherInMainPage" value="<%=editTn.publisherId%>">
<input type="hidden" name="cmbprice" value="<%=editTn.priceType%>">
<input type="hidden" name="txtcredits" value="<%=editTn.credits%>">
<script>
//now change the values in the form
parent.fillForm();
</script>
<%}else{%>
<input type="hidden" name="txtcode" value="">
<input type="hidden" name="txttonname" value="">
<input type="hidden" name="cmbmovies" value="">
<input type="hidden" name="cmbartists" value="">
<input type="hidden" name="hdcoArtists" value="">
<input type="hidden" name="cmbactors" value="">
<input type="hidden" name="terrSubpubStr" value="">
<input type="hidden" name="cmbtonetype" value="">
<input type="hidden" name="cmbSong" value="">
<input type="hidden" name="lyrics" value="">
<!-- Added by Jay for bringing publisher in Main Page -->
<input type="hidden" name="cmbPublisherInMainPage" value="">
<input type="hidden" name="cmbprice" value="">
<input type="hidden" name="txtcredits" value="">

<%}%>

<script>
document.frmBuffer.txtbufsize.value='<%=Bufsize%>';
//code added by .P on 09/01/2007
if(parent.document.frmFill.btnBufUplaod.disabled == true){
uploadBuff();
document.frmBuffer.txtaddeditvalue.value=="0"
}
</script>

</form>
</div>
</body>
</html>










Related Pages:
unicode support in javascript - JSP-Servlet
unicode support in javascript  We are facing problem while editing the tha text in a text box and sending it to next jsp. we are using UTF-8 encoding for jsp and charset as windows-874 for html meta charset. Can anybody help me
Java Unicode
Java Unicode  To insert Unicode word into MySql database using Java
Java Unicode
Java Unicode  To insert Unicode word into MySql database using Java
unicode characters
unicode characters  class Unicode { public static void main(String args[]) { char ch='\000a'; System.out.println("ch is:"+ch); } } on compilation this gives following errore:: CharLiteral6.java:5: error: illegal line end
Unicode - JDBC
Unicode  hi i wanna retrieve Unicode values from the database........when i do so and print the fetched values in java control (JTextArea) or IN doc or RTF or WEB page it get the UNICODE as ????? what can i do so
unicode characters
unicode characters  class Unicode { public static void main(String args[]) { char ch='\000a'; System.out.println("ch is:"+ch); } } on compilation this gives following errore:: CharLiteral6.java:5: error: illegal line end
unicode characters
unicode characters  class Unicode { public static void main(String args[]) { char ch='\000a'; System.out.println("ch is:"+ch); } } on compilation this gives following errore:: CharLiteral6.java:5: error: illegal line end
unicode handling in java
unicode handling in java  reading a unicode text file in java
JavaScript method fromCharCode()
JavaScript method fromCharCode()       This section illustrates you the use of JavaScript method... sequence of Unicode character values.  Its Syntax
PDF Generation for unicode characters
PDF Generation for unicode characters  Hi, How a PDF file having unicode characters is generated in JSP
unicode - Swing AWT
unicode  hi i wanna retrieve Unicode values from the database........when i do so and print the fetched values in java control (JTextArea) or IN doc or RTF or WEB page it get the UNICODE as ????? what can i do so
SQL or UNICODE - SQL
SQL or UNICODE   Hi again............ I have got something new... ASCII and other With UNICODE 1] when i trying to pass parameter to database i.e UNICODE and fetches ASCII it retrieves nothing to display 2] when trying
Java: Unicode
Java: Unicode Unicode is a system of encoding characters. All characters and Strings in Java use the Unicode encoding, which allows truly international programming. About Unicode The Unicode effort is not coordinated with Java
Java unicode - Java Beginners
Java unicode  I can read unicode character(malayalam language character) from a file but not able to print the character without installing a malayalam font(corresponding language font). Please help me to solve
What is JavaScript?
, and string libraries W3C DOM support in the JavaScript. For other JavaScript...What is JavaScript?  Hi, Sometime the students trying to know make... is Java script and other java related queries. How to define what is JavaScript
Unicode - Java Beginners
Unicode  How to print unicode value of a char. Eg. /u0000 on console(default value of a char)  Hi Friend, Try the following code: import java.io.*; import java.util.*; public class Unicode { public static
JavaScript - JavaScript Tutorial
of Unicode character values.     JavaScript method...JavaScript - JavaScript Tutorial JavaScript Tutorials is one of the best Quick reference to the JavaScript. In this JavaScript reference you will find
boolean operators in JavaScript
boolean operators in JavaScript  What boolean operators does JavaScript support
How java work on Unicode machanish
How java work on Unicode machanish   How the data are stored in java as unicode, how the conversions is done for input/output stream. Please describe in detail with memory aspect
Prinnt UNICODE character on swing component
Prinnt UNICODE character on swing component  Hello, I am trying to put unicode character n swing component. can anyone tell me how to do this? Thank you
javascript - Ajax
click on particular image of slide show in javascript. i used href tag but it does not work so i m posting my javascript code here below. note: in the head...; function slideit(){ //if browser does not support the image object, exit
Javascript code
Javascript code  Dear Sir, Thank you a lot for your support throughout the process. Here again i am in a doubt.Can you please clarify? I have a page called studentRegd.jsp,which then redirect it to studentDetail.jsp
Javascript code
Javascript code  Thank you a lot for your support throughout the process. Here again i am in a doubt.Can you please clarify? I have a page called studentRegd.jsp,which then redirect it to studentDetail.jsp,then it redirects
Javascript code
Javascript code  Dear Sir, Thank you a lot for your support throughout the process. Here again i am in a doubt.Can you please clarify? I have a page called studentRegd.jsp,which then redirect it to studentDetail.jsp
UNICODE or SQL statement issue - JDBC
UNICODE or SQL statement issue  Hi again............ I have got... with having ASCII and other With UNICODE 1] when i trying to pass parameter to database i.e UNICODE and fetches ASCII it retrieves nothing to display 2
Conversion of unicode to its corresponding character
Conversion of unicode to its corresponding character  i have a string of unicodes e.g String s="\c0059\c0049\c3000" .. i need code for converting these unicodes to its corresponding alphabets.. pls if possible rep asap as i need
Using Unicode Variable Names - Java Tutorials
Using Unicode Variable Names 2001-11-23 The Java Specialists' Newsletter [Issue 036] - Using Unicode Variable Names Author: Dr. Heinz M. Kabutz...". This week, we will look at the strange things that happen when we try to use unicode
How To Turn On the Session Support?
How To Turn On the Session Support?  How To Turn On the Session Support
Does hibernate support polymorphism?
Does hibernate support polymorphism?  Hi, Does hibernate support polymorphism? thanks
JavaScript method charCodeAt()
JavaScript method charCodeAt()       This section illustrates you the use of JavaScript method charCodeAt(). The charCodeAt() method returns the Unicode of the character at a specified
Inform user to enable JavaScript
not support JavaScript!</noscript> </body> </HTML>...Inform user to enable JavaScript   Hi sir How can we inform user to turn on JavaScript ? Because if we have implemented validation etc
Convert String to unicode and ascii
Description: This example demonstrate how to convert the general string to unicode and ascii type Code: import java.net.IDN...; + unicode);   } } Output
How to get the unicode of chinese character input in j2me/java
How to get the unicode of chinese character input in j2me/java  Hi All, How to get the Unicode of a chinese character either in j2me or Java? Please provide the sample code snippet for the above ? Thanks in advance... Thanks
What is JavaScript? - Definition
support in their browsers. Benefits of JavaScript Following are the benefits... DOM support in the JavaScript Disadvantages of JavaScript Developer depends on the browser support for the JavaScript There is no way to hide
How to get the unicode of japanese character input in java
How to get the unicode of japanese character input in java  Good... the text into japanese that needS to be converted as a unicode. for that I need a function,method or something through which i can get the unicode of japanese
bi language support - Struts
bi language support  Hi, Expert how can i use hindi font support in struts application
multiple language support iPhone
multiple language support iPhone  Is it possible to create an application in iPhone that can support multiple languages.   Yes, iPhone/iPad applications support the multi language applications. To create your iPhone
iText support android? - MobileApplications
iText support android?   would iText support android? i ve linked the iText.jar file with my android project developed in eclipse... //code Document document = new Document(PageSize.A4, 50, 50, 50, 50
Will iPhone Safari support Ajax?
Will iPhone Safari support Ajax?  hello, I want to know that Safari support Ajax ???   hello, Yes, Steve Jobs has said in the past that AJAX can be used to make programs that run within Safari on the phone.  
JavaScript
JavaScript  clone JavaScript
unicode conversion to its actual text format
unicode conversion to its actual text format  hi, i am saving the hindi text into the database. It is saving in db as "हिन्डि". But while fetching i am not able to fetch the same hindi text
Working with JavaScript & CSS
attributes to provide javascript support like onblur, onchange, onclick...Working with JavaScript & CSS   ...;JSF JavaScript & CSS</title> <script type="text
javascript
javascript  javascript code to dynamically add table on button click.../javascript/javascriptexamples/javascript-add-row-dynamically.shtml http://www.roseindia.net/javascript/javascript-add-row-to-table.shtml http://www.roseindia.net
vCard and iCalendar support for ruby
vCard and iCalendar support for ruby       vCard and iCalendar support for ruby Read full Description
Generate unicode malayalam PDF from JSP
Generate unicode malayalam PDF from JSP   Hi, I want to generate... the same report to be saved as PDF in unicode malayalam font.I have tried to generate PDF reports using IText,but I dont know how to generate unicode malayalam
Javascript
Javascript  How validations are done using javascript ,with example? and interview questions on javASCRIPT
Determining the Word Boundaries in a Unicode String
Determining the Word Boundaries in a Unicode String In this section, you will learn how to determine the word boundaries in a unicode string. Generally, we use split() method and StringTokenizer class to break the string into words