Hello,
I am looking fow C# equivalent of JavaScripts escape() and unescape()
functions. I need to use C# function at the server side and then be able to
use the opposite at the client side.
JavaScripts escape() function converts all non-alphanumerical chars to %xx,
and all unicode chars to %uxxxx (where xxxx is unicode charcode). I'd like
to have C# function that get this escaped string back to normal at the
server side. Perhaps there is a built-in one?
I've beenu using System.Web.Http Utility.UrlEnco de till now, but it differs
from escape(). For example, JavasScript will not convert unescape('+') to
single space. It will differently treat unicode characters, too.
Of course, I could code these conversion functions myself, just was
wandering if there are ones already present in the deep forests of .NET
built-in classes.
Thanks,
Pavils 2 14471
"Pavils Jurjans" <pa****@mailbox .riga.lv> wrote in
news:uT******** ******@tk2msftn gp13.phx.gbl: Hello,
I am looking fow C# equivalent of JavaScripts escape() and unescape() functions. I need to use C# function at the server side and then be able to use the opposite at the client side.
JavaScripts escape() function converts all non-alphanumerical chars to %xx, and all unicode chars to %uxxxx (where xxxx is unicode charcode). I'd like to have C# function that get this escaped string back to normal at the server side. Perhaps there is a built-in one?
I've beenu using System.Web.Http Utility.UrlEnco de till now, but it differs from escape(). For example, JavasScript will not convert unescape('+') to single space. It will differently treat unicode characters, too.
Of course, I could code these conversion functions myself, just was wandering if there are ones already present in the deep forests of .NET built-in classes.
Pavils,
You can use JScript.Net to create a server-side assembly (dll) that
exposes the escape and unescape methods (actually you should use the
encodeURI and decodeURI methods). Your server-side C# code could
call the methods in this assembly.
Hope this helps.
Chris.
-------------
C.R. Timmons Consulting, Inc. http://www.crtimmonsinc.com/
Hi Chris,
Well, it's not URI I am trying to pass here. It's a custom-formatted string
data, that I just need to make transfer-safe. "escape" method is good as its
really short and present alway at the client side without need to add
additional encoding/decoding code. Thanks for the suggestion io get them to
server side via JScript DLL, I'll test whats faster - hand-made C# method or
the one in JScript dll.
Regards,
-- Pavils
"Chris R. Timmons" <crtimmons@X_NO SPAM_Xcrtimmons inc.com> wrote in message
news:Xn******** *************** ***********@207 .46.248.16... "Pavils Jurjans" <pa****@mailbox .riga.lv> wrote in news:uT******** ******@tk2msftn gp13.phx.gbl:
Hello,
I am looking fow C# equivalent of JavaScripts escape() and unescape() functions. I need to use C# function at the server side and then be able to use the opposite at the client side.
JavaScripts escape() function converts all non-alphanumerical chars to %xx, and all unicode chars to %uxxxx (where xxxx is unicode charcode). I'd like to have C# function that get this escaped string back to normal at the server side. Perhaps there is a built-in one?
I've beenu using System.Web.Http Utility.UrlEnco de till now, but it differs from escape(). For example, JavasScript will not convert unescape('+') to single space. It will differently treat unicode characters, too.
Of course, I could code these conversion functions myself, just was wandering if there are ones already present in the deep forests of .NET built-in classes.
Pavils,
You can use JScript.Net to create a server-side assembly (dll) that exposes the escape and unescape methods (actually you should use the encodeURI and decodeURI methods). Your server-side C# code could call the methods in this assembly.
Hope this helps.
Chris. ------------- C.R. Timmons Consulting, Inc. http://www.crtimmonsinc.com/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Daniel |
last post by:
I'm working with strings that contain xml escape codes, such as '0'
and need a way in python to unescape these back to their ascii
representation, such as '&' but can't seem to find a python method for
this. I tried xml.sax.saxutils.unescape(s), but while it works with
'&', it doesn't work with '0' and other numeric codes. Any
suggestions on how to decode the numeric xml escape codes such as this?
Thanks.
--
To reply to me directly,...
|
by: Paul Watson |
last post by:
How can I get the escapes from a command line parameter interpreted?
The user provides a string on the command line. The string might contain
traditional escapes such as \t, \n, etc. It might also contain escaped
octal or hex such as \001 or \x09.
The escapes are coming into sys.argv without shell interpretation. Do I
need to use the compile module to make this work? Any suggestions?
===
|
by: harrelson |
last post by:
I have a list of about 2500 html escape sequences (decimal) that I need
to convert to utf-8. Stuff like:
비
행
기
로
보
낼
거
|
by: JigMan |
last post by:
When chucking data in a cookie you cannot use certain characters (in
this example ‘ : ‘ ).
To get around this you use escape and unescape. Trying to use the
escape as such:
Response.Cookies("Lines")("URL4") = escape("http://www.ASP101.com")
Gives the following result:
|
by: swayze |
last post by:
Hi,
I'm sending some vars to php from javascript. These vars contain
special chars (like "&" ,",")and also turkish characters. Therefore
I'm using javascripts escape() function to be able to send them
properly. My problem is on the php side. I am using rawurldecode to
convert them back. However, Turkish characters like "I" (capital "I"
with a dot on top) for example still stay encoded as "%u0130".
My page is setup to handle turkish...
| |
by: Harry Keck |
last post by:
Is there a set of methods in the .Net framework that do the same thing as the
jscript functions escape and unescape?
I get very close with HttpUtility.UrlEncodeUnicode, but it puts "+" for
spaces instead of "%20". Uri.EscapeString seems to create the correct escape
string, but there is no unescape. The function is not public anyway, so I
probably shouldn't use it.
I need a way to escape text on the client, and then unescape it on the...
|
by: gomzi |
last post by:
hi,
I would like to know as to what the equivalent functions are in .net for the escape and unescape functions that we have in javascript.
tried both Server.HtmlEncode & Server.UrlEncode without much success.
i.e.
when i have something like this...
string-> how'zat'
|
by: Philipp |
last post by:
How do I convert a string to escaped HTML? (Let's say I'm not using
DOM.) E.g. "<p>foo</p>" would become "<p>foo</p>"?
Reversely, how do I unescape a string to be HTML? E.g. "<em>"
would turn back into "<em>".
I mean a function like the following would do the job but is there a
more JS-native solution?
html = html.replace(/&/g, "&");
|
by: RK |
last post by:
Perhaps I'm confused somwhere in my understanding, but I'm trying to
deal with some escaped text from an XML file which includes html markup
and it appears there are a couple of techniques for escape codes.
(I hope I can describe my issue here without having to worry about how
to escape it for display on this group!)
On the server-side I extract some text from an XML file, which includes
some style and content. The XML is simply:
|
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...
|
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,...
| |
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...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
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...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |