473,769 Members | 8,134 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Preserving the Character set inside text area

5 New Member
HI

I want to display the contents of a big XML inside a text area so that the user would be able to edit it. But the XML consists of characters such as & " which are interpreted by as & and " respectively.
But if this going to be the case the backend systems could not read them. I used <xmp>, but it is already deprecated and further it would not work inside text area. Could somebody help me with this.

in short : &amp; should be displayed as &amp; itself and not & inside the textarea.

Vinoth
Apr 4 '07 #1
16 4416
KevinADC
4,059 Recognized Expert Specialist
javascript I am sure can do the proper character escaping, but I don't know how to do it myself. You can also do it server side with PHP or perl or other scripting language. Bascially the & symbol needs to converted to &amp; so &amp; would become &amp;amp; etc etc etc.
Apr 4 '07 #2
AricC
1,892 Recognized Expert Top Contributor
HI

I want to display the contents of a big XML inside a text area so that the user would be able to edit it. But the XML consists of characters such as &amp; &quot; which are interpreted by as & and " respectively.
But if this going to be the case the backend systems could not read them. I used <xmp>, but it is already deprecated and further it would not work inside text area. Could somebody help me with this.

in short : &amp; should be displayed as &amp; itself and not & inside the textarea.

Vinoth
Maybe this is more of an XML question?
Apr 4 '07 #3
rite2vinoth
5 New Member
javascript I am sure can do the proper character escaping, but I don't know how to do it myself. You can also do it server side with PHP or perl or other scripting language. Bascially the & symbol needs to converted to &amp; so &amp; would become &amp;amp; etc etc etc.
Yeah.Basically the round about would be to do a replace all of &amp; with &amp;amp; and so on which we eventually did in the server side. But I wanted to know if anything could be done in the client side itself.

Thanks a lot anyways.
Apr 5 '07 #4
rite2vinoth
5 New Member
Maybe this is more of an XML question?
Not necessarily. The question is about the browser marking up the character sets and predominanty HTML stuff and javascript.

thanks
Apr 5 '07 #5
KevinADC
4,059 Recognized Expert Specialist
Yeah.Basically the round about would be to do a replace all of &amp; with &amp;amp; and so on which we eventually did in the server side. But I wanted to know if anything could be done in the client side itself.

Thanks a lot anyways.
I am pretty sure javascript can do the escaping, but I don't know how to do that or if in fact it can be done. Ask in the javascripting forum. As far as the browser itself goes, there is no mechanism I know of to do what you want.
Apr 5 '07 #6
rite2vinoth
5 New Member
I am pretty sure javascript can do the escaping, but I don't know how to do that or if in fact it can be done. Ask in the javascripting forum. As far as the browser itself goes, there is no mechanism I know of to do what you want.
Thanks Kevin for that. :-)
Apr 5 '07 #7
srinivasang87
2 New Member
I am pretty sure javascript can do the escaping, but I don't know how to do that or if in fact it can be done. Ask in the javascripting forum. As far as the browser itself goes, there is no mechanism I know of to do what you want.
I thought on the same lines. But javascript doesnt do anything special here!
These are the things I tried..

1. s=escape('&amp; ');
document.writel n("escaped string : "+s);

t=unescape('&am p;');
document.writel n("unescaped string : "+t);

Both returned '&'

2. <xmp>&amp;</xmp> OR <pre>&amp;</pre>
Both were displayed AS IS (ALONG WITH TAGS) inside the text area. But <xmp> did work OUTSIDE the textarea. But not a great idea as its already deprecated!

3. <plaintext> -- NEVER use this! It will BREAK all the HTML code after the <PLAINTEXT> tag..... All the remaining HTML will be displayed AS IS to the user..
Apr 5 '07 #8
KevinADC
4,059 Recognized Expert Specialist
OK, but who said anything about using the <plaintext> tag?
Apr 5 '07 #9
drhowarddrfine
7,435 Recognized Expert Expert
<plaintext>? Are we making up elements as we go along?

You should carry on this javascript discussion on the javascript board.
Apr 5 '07 #10

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

Similar topics

10
2395
by: Cocy | last post by:
Hi, This might be a sort of FAQ, but I don't see why, so I would someone help me to understand what's wrong? I've just created following code which wold trim white space(s) in a (given) string. But, it resulted the Segmentation fault, and so as when running in gdb (saying "Program received signal SIGSEGV, Segmentaion fault at *p++ = *st++"). The platform is Linux kernel 2.4.27, gcc version
16
5138
by: TTroy | last post by:
Hello, I'm relatively new to C and have gone through more than 4 books on it. None mentioned anything about integral promotion, arithmetic conversion, value preserving and unsigned preserving. And K&R2 mentions "signed extension" everywhere. Reading some old clc posts, I've beginning to realize that these books are over-generalizing the topic. I am just wondering what the difference between the following pairs of terms are: 1)...
2
3379
by: Pete | last post by:
Hi all... I sincerly hope one of the MS guys can clear this up for me... First some background... Ok, I have a web site which is fully translatable into several languages. All the strings for the web site are held in a database and all the labels, buttons etc are populated at run time in the Page_Load handler. The retreval of the strings from the database is all
3
10201
KevinADC
by: KevinADC | last post by:
Purpose The purpose of this article is to discuss the difference between characters inside a character class and outside a character class and some special characters inside a character class. This is not a regular expression tutorial. Assumes you are already familiar with basic regular expression concepts and terminology. If not, you may want to read some regular expression tutorial. See the end of the article for links to online resources....
35
4254
by: rajash | last post by:
Hello everyone, Thanks again for all the suggestions, though I think some people are a bit fussy in their answers. Here is a solution to Exercise 1.14. It deals well with control characters too. // make histogram of character frequencies
3
3301
by: sophia.agnes | last post by:
Dear all, I was going through the book "C a software engineering approach by darnell & Margolis" there was a section named sign preserving vs value preserving it is as follows sign preserving rule:- when signed and un signed objects meet in an expression, the result is
1
4482
by: amulyab | last post by:
Hi, M using browse button to select a text file.The contents of text is made to display inside text area.Now i have to add some links for the some parts of text which is inside text area.How can i do this?Please help me.
1
1484
by: amulyab | last post by:
Hi, M using browse button to select a text file.The contents of text is made to display inside text area.Now i have to add some links for the some parts of text which is inside text area.How can i do this?Please help me.Is there any way to do in ajax or javascript.
1
6677
by: coolguyraj | last post by:
Hi i have the following HTML code for the text Area how can i disable the enter key inside the text area. <td colspan="7"><textarea cols="80" onkeypress="keyhandler<?php echo $x?>()" rows="5" name='ITEM_IN'><?php echo $_REQUEST);?></textarea></td> Help will be greatly appriciated. Thanks
0
9589
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10219
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8876
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3567
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.