View Complete Post
I'm trying to strip illegal characters out of an XML string before I send it off to a public web service. The xml will look something like this:
<field name="notes">This is a note. Any character could appear here</field>
I need to pull out any ampercand (&) charachters in the any of the fields, as well as any < or > characters, which would make the XML unreadable.
I've tried it like this:
Private Shared Function cleanQuery(ByVal queryNode As String) As String
Dim root As XElement = XElement.Parse(queryNode)
For Each x As XElement In root.Elements
x.Value = x.Value.Replace("&", "&").Replace("<", "<").Replace(">", ">")
That doesn't work so well. I get the error stating:
There are multiple root elements. Line 1, position 15.
I tried wrapping the XML in a single root element, like this:
Private Shared Function cleanQuery2(ByVal q
On my web application, I display information in different languages. Everything works fine in IE compatibility mode and FireFox but it shows boxes for chinese/japanese languages. I am pretty much having the same issue as described here
Thanks for your help.
Can anyone tell me the best way of storing Japanese characters through ASP.NET.I have to put characters into a asp:textbox on one page, which saves it to an Access DB.On a second page I want to display the content in a asp:label.
Should I store the characters directly to the database or should they be encoded, andhow do I encode the characters?
In my web.config i have:
<globalization fileEncoding="ISO-2022-JP" requestEncoding="ISO-2022-JP" responseEncoding="ISO-2022-JP" culture="ja-JP" uiCulture="ja-JP" />
On the display page I have:
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=shift_jis">
I am working on a site where I use the Split function on a string.
To make sure I used a separator character that I do not use anywhere in the data I selected the character 'ÃÂ£'.
This worked fine in Firefox and Safari, but in IE8 I get an 'Index out of range' error, so apparently the 'ÃÂ£' character is not handled correctly.
I changed the separator to ';', and then it works fine.
i have a string like this sravani/, asdfff/, lsdsf/i want to remove last character '/' in the above string...which function can i use?pls help me....
Edited by Nancy Michell
MSDN Magazine December 2004
Good afternoon ASP programmers,
I am creating an application that creates math problems for students. I wish to use a special character for negation to differentiate it from the minus sign. I am using the Unicode character U02c9.
var symMul= "Ãâ"; var symDiv= "ÃÂ·"; var symNeg= "?";
Both IE & Fire Fox correctly render the symDiv and symMul symbols. Any suggestion would be greatly appreciated.
I recently switched from freetextbox to the built in Ajax editor because of issues ftb had with update panels. The Ajax editor works great except for one problem, it messes up my spanish characters. For instance, it will replace ÃÂ± with ? and post the ? to my database. Is there anyway to not make it do this and leave it as the actual ÃÂ± ? if the same characters is placed in a standard textbox it will submit with no problem.
Thanks for your time!
I have a dropdownlist which I dynamically select a list item using findbytext as long as there are no special characters. One entry in the list starts with a percent symbol which I have been unable to dyncamically select. I have confirmed that there are no spaces in the list item and have hard coded the query with the string to try to find the problem. FindByText("% Increase") I believe it has something to do with the special character but have been unable to identify a method to work around this. Any help would be appreciated.VBIf Not ddlColumns1.Items.FindByText(strDefault) Is Nothing Then ddlColumns1.Items.FindByText(strDefault).Selected = TrueEnd If
I have a MySQL database, which contains columns with danish characters like ÃÂ¸ ÃÂ¦ and ÃÂ¥.
When the MySqlDataReader tries to read this column name:
for (int i = 0; i < MysqlReader.FieldCount; i++)
string Key = MysqlReader.GetName(i);
The result is not the expected character, but some kind of ASCII value of it. For an example, 'ÃÂ¥' gets interpreted as 'ÃÆÃâÃâÃÂ¥'.
What to do?
Thanks alot for your help :)