From: Krishna on 15 Dec 2009 02:03 I've attached a sample.aspx content, i've already doing a character conversion from SHIFT-JIS to windows-1252, i've set responseconding to 'windows-1252' to post the data (rightclick on IE and encoding is western european). but when i do that the , button which has japan text comes as question mark... so what i need is that post with windows 1252 and have the button display in same as displayed in the page. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" ResponseEncoding="windows-1252"%> <!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"> <script language="C#" runat="server"> public string in_simei_sei { get { string test = "陳"; Encoding nav = Encoding.GetEncoding(1252);; Encoding unicode = Encoding.GetEncoding(932); byte[] unicodeBytes = unicode.GetBytes(test); return nav.GetString(unicodeBytes); } } </script> <script language="javascript" type="text/javascript"> function add(type, value) { try { var element = document.createElement("input"); element.setAttribute("type", type); element.setAttribute("value", value); element.setAttribute("name", type); element.setAttribute("visible", false); var foo = document.forms[0]; foo.appendChild(element) } catch (err) { var txt = "There was an error on this page.\n\n"; txt += "Error description: " + err.description + "\n\n"; txt += "Click OK to continue.\n\n"; alert(txt) return; } } function postData() { try { add("in_simei_sei", "<%=in_simei_sei%>"); } catch(err) { var txt = "There was an error on this page.\n\n"; txt += "Error description: " + err.description + "\n\n"; txt += "Click OK to continue.\n\n"; return; } var xmlhttp = null; if (window.XMLHttpRequest) { // code for Firefox, Mozilla, IE7, etc. try { xmlhttp = new XMLHttpRequest(); // instantiate it } catch (err) { alert("Error initializing XMLHttpRequest.\n" + err); // show error } } else if (window.ActiveXObject) { var msobj = new Array( "Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.4.0", "Msxml2.XMLHTTP.3.0", "Msxml2.XMLHTTP", "Microsoft.XMLHTTP"); var x, len = msobj.length; for (x = 0; x < len; ++x) { try { xmlhttp = new ActiveXObject(msobj[x]); break; } catch (err) { alert("Error initializing XMLHttpRequest : IE : \n" + err.message); // show error }; } alert("inside else") } var processingUrl = "http://www.google.com"; try { xmlhttp.open("POST", processingUrl,true); ; // open server interface } catch (err) { var txt = "There was an error on this page.\n\n"; txt += "Error description: " + err.description + "\n\n"; txt += "Click OK to continue.\n\n"; // alert(txt); return; } if (xmlhttp.readyState == 1) { try { xmlhttp.send(c_var); } catch (z) { alert(z) } } // } </script> </head> <body> <form id="Form1" runat="server" onsubmit="postData();" method="post" action="http://www.google.com"> <input type=submit runat="server"> <input type=button value="PC商品一式" /> </form> </body> </html>
From: Krishna on 23 Dec 2009 05:03 any thoughts on my below ask? "Krishna" wrote: > I've attached a sample.aspx content, i've already doing a character > conversion from SHIFT-JIS to windows-1252, i've set responseconding to > 'windows-1252' to post the data (rightclick on IE and encoding is western > european). but when i do that the , button which has japan text comes as > question mark... so what i need is that post with windows 1252 and have the > button display in same as displayed in the page. > > <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" > Inherits="_Default" ResponseEncoding="windows-1252"%> > <!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"> > <script language="C#" runat="server"> > > public string in_simei_sei > { > get > { > string test = "陳"; > Encoding nav = Encoding.GetEncoding(1252);; > Encoding unicode = Encoding.GetEncoding(932); > byte[] unicodeBytes = unicode.GetBytes(test); > return nav.GetString(unicodeBytes); > } > } > </script> > <script language="javascript" type="text/javascript"> > > function add(type, value) { > try { > > var element = document.createElement("input"); > element.setAttribute("type", type); > element.setAttribute("value", value); > element.setAttribute("name", type); > element.setAttribute("visible", false); > var foo = document.forms[0]; > foo.appendChild(element) > > } > catch (err) { > var txt = "There was an error on this page.\n\n"; > txt += "Error description: " + err.description + "\n\n"; > txt += "Click OK to continue.\n\n"; > > alert(txt) > return; > } > } > > > > function postData() > { > try { > > add("in_simei_sei", "<%=in_simei_sei%>"); > } > catch(err) > { > var txt = "There was an error on this page.\n\n"; > txt += "Error description: " + err.description + "\n\n"; > txt += "Click OK to continue.\n\n"; > return; > } > var xmlhttp = null; > if (window.XMLHttpRequest) { > // code for Firefox, Mozilla, IE7, etc. > try > { > xmlhttp = new XMLHttpRequest(); // instantiate it > } > catch (err) > { > alert("Error initializing XMLHttpRequest.\n" + err); // show > error > } > } > else if (window.ActiveXObject) > { > > var msobj = new Array( "Msxml2.XMLHTTP.6.0", > "Msxml2.XMLHTTP.4.0", > "Msxml2.XMLHTTP.3.0", > "Msxml2.XMLHTTP", > "Microsoft.XMLHTTP"); > > var x, len = msobj.length; > for (x = 0; x < len; ++x) > { > try > { > xmlhttp = new ActiveXObject(msobj[x]); > break; > } > catch (err) > { > alert("Error initializing XMLHttpRequest : IE : \n" + > err.message); // show error > }; > } > alert("inside else") > } > var processingUrl = "http://www.google.com"; > > try > { > xmlhttp.open("POST", processingUrl,true); ; // open server > interface > } > catch (err) > { > var txt = "There was an error on this page.\n\n"; > txt += "Error description: " + err.description + "\n\n"; > txt += "Click OK to continue.\n\n"; > // alert(txt); > return; > } > > if (xmlhttp.readyState == 1) > { > try > { > xmlhttp.send(c_var); > } > catch (z) > { > alert(z) > } > } > > // > } > </script> > </head> > <body> > > <form id="Form1" runat="server" onsubmit="postData();" method="post" > action="http://www.google.com"> > <input type=submit runat="server"> > <input type=button value="PC商品一式" /> > </form> > </body> > </html> >
From: Gregory A. Beamer on 23 Dec 2009 10:47 =?Utf-8?B?S3Jpc2huYQ==?= <Krishna(a)discussions.microsoft.com> wrote in news:8637DF17-C7E1-4D9F-99BF-5866D1A1F8C7(a)microsoft.com: > any thoughts on my below ask? Let's step back. Looking at the page, it looks like you are setting up a form submit to google. Is that your goal? Submit to Google and get a valid search? Rather than "how to I solve the problem in the manner I am already trying to solve it" let's get to "how do I solve the problem". So, what is the goal. Not the goal plus the proposed solution, but a simple statement of what the actual problem is. Peace and Grace, -- Gregory A. Beamer (MVP) Twitter: @gbworld Blog: http://gregorybeamer.spaces.live.com ******************************************* | Think outside the box! | *******************************************
From: Krishna on 24 Dec 2009 05:50 ok. Lets say i want to post the data to a http:\\localhost\mysite\default.aspx. when i cut paste the below code and put in sample.aspx and run it, right click in IE , it has encoding as western european coz i've set responseencoding as 'windows-1252' right. My question is : Page has a button <input type=button value="PC商品一式" /> with Japenese text, which comes as ?????, i hope u have noticed it when type in sample.aspx in the browser. SO my question is i want the japaenese text button remains as it is and i wanna choose encoding as 'western european' to post the data when i click the submit button. is my question clear :(? ================================================ <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" ResponseEncoding="windows-1252"%> <!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"> <script language="C#" runat="server"> public string in_simei_sei { get { string test = "陳"; Encoding nav = Encoding.GetEncoding(1252);; Encoding unicode = Encoding.GetEncoding(932); byte[] unicodeBytes = unicode.GetBytes(test); return nav.GetString(unicodeBytes); } } </script> <script language="javascript" type="text/javascript"> function add(type, value) { try { var element = document.createElement("input"); element.setAttribute("type", type); element.setAttribute("value", value); element.setAttribute("name", type); element.setAttribute("visible", false); var foo = document.forms[0]; foo.appendChild(element) } catch (err) { var txt = "There was an error on this page.\n\n"; txt += "Error description: " + err.description + "\n\n"; txt += "Click OK to continue.\n\n"; alert(txt) return; } } function postData() { try { add("in_simei_sei", "<%=in_simei_sei%>"); } catch(err) { var txt = "There was an error on this page.\n\n"; txt += "Error description: " + err.description + "\n\n"; txt += "Click OK to continue.\n\n"; return; } var xmlhttp = null; if (window.XMLHttpRequest) { // code for Firefox, Mozilla, IE7, etc. try { xmlhttp = new XMLHttpRequest(); // instantiate it } catch (err) { alert("Error initializing XMLHttpRequest.\n" + err); // show error } } else if (window.ActiveXObject) { var msobj = new Array( "Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.4.0", "Msxml2.XMLHTTP.3.0", "Msxml2.XMLHTTP", "Microsoft.XMLHTTP"); var x, len = msobj.length; for (x = 0; x < len; ++x) { try { xmlhttp = new ActiveXObject(msobj[x]); break; } catch (err) { alert("Error initializing XMLHttpRequest : IE : \n" + err.message); // show error }; } alert("inside else") } var processingUrl = "http:\\localhost\mysite\default.aspx"; try { xmlhttp.open("POST", processingUrl,true); ; // open server interface } catch (err) { var txt = "There was an error on this page.\n\n"; txt += "Error description: " + err.description + "\n\n"; txt += "Click OK to continue.\n\n"; // alert(txt); return; } if (xmlhttp.readyState == 1) { try { xmlhttp.send(c_var); } catch (z) { alert(z) } } // } </script> </head> <body> <form id="Form1" runat="server" onsubmit="postData();" method="post" action="http:\\localhost\mysite\default.aspx"> <input type=submit runat="server"> <input type=button value="PC商品一式" /> </form> </body> </html>
From: Gregory A. Beamer on 28 Dec 2009 10:14 =?Utf-8?B?S3Jpc2huYQ==?= <Krishna(a)discussions.microsoft.com> wrote in news:B7FFC85E-74A6-4E19-B437-E7405D1E67A7(a)microsoft.com: > Page has a button <input type=button value="���ņ" �� �� " /> > with Japenese text, which comes as ?????, i hope u have noticed it > when type in sample.aspx in the browser. SO my question is i want the > japaenese text button remains as it is and i wanna choose encoding as > 'western european' to post the data when i click the submit button. is > my question clear Is the button the only problem? If the button simply has to be in Japanese, but all submissions need to be in 1252, then why not make an image with the japanese characters and leave everything else 1252. This will solve the button is not Japanese problem, if that is truly the problem. ImageButton works nicely here and is much simpler than translating the button. If the main issue is output of the button on an otherwise 1252 page, you are always going to have an issue. And if you are setting up the page as Japanese and trying to convert, that might be a more complex solution than needed. Is the text entered Japanese? And, do you have to recreate it as Japanese later? Is storing in a database a problem? And, if so, can you change to national variable character (2 byte, or Unicode) insted of variable character (1 byte, or ANSI - ASCII if you wish)? Or, perhaps you are really aiming at globalizing the application? If so, there are numerous additions that allow for globalizing the application. The main point of translating from one code page to another, or ANSI to Unicode, etc, is the persistence of data. In a windows app, it could be taking a Unicode file and saving as ANSI. In a web app, it might be saving as varchar in SQL Server when the page is Unicode. But making a whole page Japanese so you can make the button correct and then converting everything to another code page to save in English goes contrary to the way the system is meant to operate. Am I hitting on the right direction, or did I miss something? Peace and Grace, -- Gregory A. Beamer (MVP) Twitter: @gbworld Blog: http://gregorybeamer.spaces.live.com ******************************************* | Think outside the box! | *******************************************
|
Pages: 1 Prev: SiteMapPath and ASP.Net Web Forms Routing Next: PagerTemplate dissapearing |