473,388 Members | 1,417 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

escaping special characters in java

I'm developing a web application in which i get a string from a JSON object , **now what i need is to escape the special characters in that string**, can anyone kindly help me how to acheive this?

JSONObject rslt= new JSONObject(buf.toString());
if(rslt!=null) {
String str=rslt.getString("pc");

"pc" is the node where the string lies
Nov 7 '11 #1
0 1951

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Barry Olly | last post by:
Hi, I'm working on a mini content management system and need help with dealing with special characters. The input are taken from html form which are then stored into a varchar column in...
0
by: Simon Hawkins | last post by:
Just wondering... ... Is there a class or method in the API that will automatically 'escape' all the HTML special characters in a String, or a file? Something like the 'URLEncoder' class where the...
4
by: Ewok | last post by:
let me just say. it's not by choice but im dealing with a .net web app (top down approach with VB and a MySQL database) sigh..... Anyhow, I've just about got all the kinks worked out but I am...
3
by: MAF | last post by:
Is there a quick way to convert all special characters to XML format for example '&' to & or '+' sign to ? ?
0
by: SeanGerman | last post by:
Howdy, Is there a way to explicitly escape special characters (particularly & (&) and ' (')) when writing a data set with the WriteXml method? I know this is supposed to happen...
4
by: James Black | last post by:
I have an application that relies on JSON, and I realized yesterday that I when the user types at least some of these characters (most likely all, haven't had time to verify) that the parser has...
1
by: =?Utf-8?B?bWljaGFlbHJp?= | last post by:
We are dynamically changing the title property of nodes in our sitemappath to reflect the names of products by handling the SiteMapResolve event. We have some unicode characters in our product...
3
by: raga | last post by:
Hi Could you please let me know When i specify an attribute of an XML Tag as CDATA in DTD , can i use & straight away within the value of that attribute (instead of using & AMP ;) . If we...
7
by: wannymahoots | last post by:
optparse seems to be escaping control characters that I pass as arguments on the command line. Is this a bug? Am I missing something? Can this be prevented, or worked around? This behaviour...
1
by: autessa | last post by:
Hello, I am getting javascript errors when there are " and/or page breaks in the data bound to my grid. Used the following code: Regex.Replace(str, Regex.Escape("\n"), ""); -- the same with the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.