The problem is that I am actually using my own Custom Web Control
which can switch between "Text Input" mode and "Label" mode.
I have the control behave like that so I don't need to keep 2 Controls (1 TextBox and 1 Label) on the web page
to switch between "Read Only" and "Edit" modes.
I just do either one of the following lines of code.
myLabelText.TextMode = MyTextMode.Label; // go to read-only mode
myLabelText.TextMode = MyTextMode.MultiLine; // go to edit mode
Then, when I render the "Text" of my LabelTextBox control, I do the following code.
Server.HtmlEncode( memberVariableTextString );
When I do that, õ character renders as õ for both Label and MultiLine text box modes. Since, õ is considered "unsafe" by the ASP.NET Request Validation, the web page throws a Request Validation error stating that potentially dangerous user input is detected.
However, this is one really weird issue. I have error logging in my application by sending out Error Notification Email. In my email, the õ character renders out exactly the way it is.
So it has to do something with the Encoding on my ASPX web page. I am using IIS 6.0 with SQL Server 2000 database with both in U.S. language and locale settings.
Anyone has any clue? I have seen some articles after some googling on the net to do the following
Response.CharSet = "UTF-8";
I may or may not have found an explanation dealing with this.
For those interested in this, please visit the KB URL from Microsoft below. http://support.microsoft.com/kb/893663
It deals with <globalization> Element in Web.config file.
I will try to give an update on this issue so anyone interested can probably learn from it.
soelinn
Member
102 Points
36 Posts
Re: õ vs õ ( Character Encoding + Server.HtmlEncode problem)
Apr 10, 2007 03:24 PM|LINK
The problem is that I am actually using my own Custom Web Control
which can switch between "Text Input" mode and "Label" mode.
I have the control behave like that so I don't need to keep 2 Controls (1 TextBox and 1 Label) on the web page
to switch between "Read Only" and "Edit" modes.
I just do either one of the following lines of code.
Then, when I render the "Text" of my LabelTextBox control, I do the following code.
When I do that, õ character renders as õ for both Label and MultiLine text box modes.
Since, õ is considered "unsafe" by the ASP.NET Request Validation, the web page throws a Request Validation error
stating that potentially dangerous user input is detected.
However, this is one really weird issue.
I have error logging in my application by sending out Error Notification Email.
In my email, the õ character renders out exactly the way it is.
So it has to do something with the Encoding on my ASPX web page.
I am using IIS 6.0 with SQL Server 2000 database with both in U.S. language and locale settings.
Anyone has any clue?
I have seen some articles after some googling on the net to do the following
I may or may not have found an explanation dealing with this.
For those interested in this, please visit the KB URL from Microsoft below.
http://support.microsoft.com/kb/893663
It deals with <globalization> Element in Web.config file.
I will try to give an update on this issue so anyone interested can probably learn from it.
Soe