unicode support in javascript

unicode support in javascript

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 Tutorials/Questions & Answers:
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
Advertisements
Java Unicode
Java Unicode  To insert Unicode word into MySql database using Java
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 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
unicode
unicode
PDF Generation for unicode characters
PDF Generation for unicode characters  Hi, How a PDF file having unicode characters is generated in JSP
ModuleNotFoundError: No module named 'unicode'
ModuleNotFoundError: No module named 'unicode'  Hi, My Python... 'unicode' How to remove the ModuleNotFoundError: No module named 'unicode... to install padas library. You can install unicode python with following command
JavaScript method fromCharCode()
JavaScript method fromCharCode()       This section illustrates you the use of JavaScript method... sequence of Unicode character values.  Its Syntax is:ADS_TO_REPLACE_1
JavaScript
JavaScript  clone JavaScript
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
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
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
Javascript
Javascript  How validations are done using javascript ,with example? and interview questions on javASCRIPT
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
JavaScript
should use JavaScript? Thanks   Hi, JavaScript is scripting language that runs on browser. You have to embed JavaScript in HTML page. Please see JavaScript tutorial. Thanks
JavaScript
JavaScript  how to get full path of a file type in javascript
javascript
javascript  Hi deepak, how to write form validation on javascript
javascript
javascript  write a program to display implement about browsers using javascript
javaScript
javaScript  How to open a browser window that cannot be resized? (HTML + Javascript
javascript
javascript  i have just learned javascript... can you tell me what kind of applications can be made by javascript?? thank you
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  how to set the request or session attribute in javascript head part of jsp page
javascript
javascript  Hi sir, This is sinduri, i want to learn javascript, so plz can u help me.how to learn
javascript
javascript  hi sir, if i want to learn javascript. what concepts i want to know
Version of com.globalmentor>globalmentor-unicode dependency
List of Version of com.globalmentor>globalmentor-unicode dependency
ModuleNotFoundError: No module named 'docopt-unicode'
ModuleNotFoundError: No module named 'docopt-unicode'  Hi, My... named 'docopt-unicode' How to remove the ModuleNotFoundError: No module named 'docopt-unicode' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'emoji-unicode'
ModuleNotFoundError: No module named 'emoji-unicode'  Hi, My... 'emoji-unicode' How to remove the ModuleNotFoundError: No module named 'emoji-unicode' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'font-unicode'
ModuleNotFoundError: No module named 'font-unicode'  Hi, My Python... 'font-unicode' How to remove the ModuleNotFoundError: No module named 'font-unicode' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'pyjavaproperties-unicode'
ModuleNotFoundError: No module named 'pyjavaproperties-unicode'  Hi...: No module named 'pyjavaproperties-unicode' How to remove the ModuleNotFoundError: No module named 'pyjavaproperties-unicode' error? Thanks  
ModuleNotFoundError: No module named 'unicode-babel'
ModuleNotFoundError: No module named 'unicode-babel'  Hi, My... 'unicode-babel' How to remove the ModuleNotFoundError: No module named 'unicode-babel' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'unicode-charnames'
ModuleNotFoundError: No module named 'unicode-charnames'  Hi, My... named 'unicode-charnames' How to remove the ModuleNotFoundError: No module named 'unicode-charnames' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'unicode_ids'
ModuleNotFoundError: No module named 'unicode_ids'  Hi, My Python... 'unicode_ids' How to remove the ModuleNotFoundError: No module named 'unicode_ids' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'unicode-mayo'
ModuleNotFoundError: No module named 'unicode-mayo'  Hi, My Python... 'unicode-mayo' How to remove the ModuleNotFoundError: No module named 'unicode-mayo' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'unicode-nazi'
ModuleNotFoundError: No module named 'unicode-nazi'  Hi, My Python... 'unicode-nazi' How to remove the ModuleNotFoundError: No module named 'unicode-nazi' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'unicode-please'
ModuleNotFoundError: No module named 'unicode-please'  Hi, My... named 'unicode-please' How to remove the ModuleNotFoundError: No module named 'unicode-please' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'unicode-slugify'
ModuleNotFoundError: No module named 'unicode-slugify'  Hi, My... named 'unicode-slugify' How to remove the ModuleNotFoundError: No module named 'unicode-slugify' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'unicode_tex'
ModuleNotFoundError: No module named 'unicode_tex'  Hi, My Python... 'unicode_tex' How to remove the ModuleNotFoundError: No module named 'unicode_tex' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'unicode_tr'
ModuleNotFoundError: No module named 'unicode_tr'  Hi, My Python... 'unicode_tr' How to remove the ModuleNotFoundError: No module named 'unicode_tr' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'winreg_unicode'
ModuleNotFoundError: No module named 'winreg_unicode'  Hi, My... named 'winreg_unicode' How to remove the ModuleNotFoundError: No module named 'winreg_unicode' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'winreg_unicode'
ModuleNotFoundError: No module named 'winreg_unicode'  Hi, My... named 'winreg_unicode' How to remove the ModuleNotFoundError: No module named 'winreg_unicode' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'winreg_unicode'
ModuleNotFoundError: No module named 'winreg_unicode'  Hi, My... named 'winreg_unicode' How to remove the ModuleNotFoundError: No module named 'winreg_unicode' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'docopt-unicode'
ModuleNotFoundError: No module named 'docopt-unicode'  Hi, My... named 'docopt-unicode' How to remove the ModuleNotFoundError: No module named 'docopt-unicode' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'emoji-unicode'
ModuleNotFoundError: No module named 'emoji-unicode'  Hi, My... 'emoji-unicode' How to remove the ModuleNotFoundError: No module named 'emoji-unicode' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'font-unicode'
ModuleNotFoundError: No module named 'font-unicode'  Hi, My Python... 'font-unicode' How to remove the ModuleNotFoundError: No module named 'font-unicode' error? Thanks   Hi, In your python
JAVASCRIPT
JAVASCRIPT  I have one textbox and I want to validate that it must start with number(1-0). can anyone tell me a javascript for that ? thanks in advance

Ads