I have added this <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">. But the problem remains same. I want to convert any string into UTF-8 but it does not work for me..
Main Topics
Browse All TopicsHello Experts,
Plz help me...
When I get the value of "s_unicode2" in a textbox, it does not convert in it's original format, while when i use response.write or label control it shows it's original value. What can i do so that the decoded string will display porperly in textbox...???
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
actually in txtEncode i want encoded utf-8 value and in txtdecode textbox i want decoded(original) value.
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.
using System.Web.UI.HtmlControls
using System.Text;
using System.IO;
public partial class Default3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// Request.ContentEncoding = Encoding.GetEncoding("UTF-
//Response.ContentEncoding
//hdnSpecialMessage.Value = Server.HtmlDecode(txtEncod
if (!IsPostBack)
{
txtEncodeMsg.Text = "";
txtDecodeMsg.Text = "";
txtReadScript.Text = "";
}
}
protected void btnEncode_Click(object sender, EventArgs e)
{
System.Text.Encoding utf_8 = System.Text.Encoding.UTF8;
//string convString = txtReadScript.Text;
//byte[] temp;
//temp = System.Text.Encoding.UTF8.
//txtEncodeMsg.Text = System.Text.Encoding.GetEn
string s_unicode = txtReadScript.Text;
byte[] utf8Bytes = utf_8.GetBytes(s_unicode);
ASCIIEncoding ascii = new ASCIIEncoding();
UTF8Encoding utf8 = new UTF8Encoding();
byte[] asciiBytes = Encoding.Convert(utf8, ascii, utf8Bytes);
}
protected void btnDecode_Click(object sender, EventArgs e)
{
System.Text.Encoding utf_8 = System.Text.Encoding.UTF8;
// This is our Unicode string:
string s_unicode = txtReadScript.Text;
// Convert a string to utf-8 bytes.
byte[] utf8Bytes = utf_8.GetBytes(s_unicode);
// Convert utf-8 bytes to a string.
string s_unicode2 = utf_8.GetString(utf8Bytes)
txtDecodeMsg.Text = s_unicode2;
// Response.Write(s_unicode2)
}
}
Decode:
string sUnicode = Stringcl.FixQuotes(txtMess
byte[] bString = Encoding.UTF8.GetBytes(sUn
string sSpecialMessage = Encoding.GetEncoding(0).Ge
string sAlias = Stringcl.FixQuotes(txtAlia
Encode:
SpecialMessagecl oSpecialMessagecl = new SpecialMessagecl(m_iSpecia
string sUnicode = oSpecialMessagecl.SpecialM
byte[] bString = Encoding.GetEncoding(0).Ge
string sDecodedString = Encoding.GetEncoding("UTF-
txtMessage.Text = sDecodedString;
Business Accounts
Answer for Membership
by: ryancysPosted on 2009-08-25 at 04:17:45ID: 25176276
tried change your page header to UTF-8 ?