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_NOSPAM_Xcrtimmonsinc.com> wrote in message
news:Xn**********************************@207.46.2 48.16...
"Pavils Jurjans" <pa****@mailbox.riga.lv> wrote in
news:uT**************@tk2msftngp13.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.HttpUtility.UrlEncode 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/