473,322 Members | 1,522 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,322 software developers and data experts.

how to do unicode conversion like the IE address bar

Hi,

I would like to do something like this

Input: http://www.test.com/

to

Output: http%3A%2F%2Fwww.test.com%2F

I can't get the the conversion working using:
temp1 = Encoding.Unicode.GetBytes(strInput);
temp2 = Encoding.Convert(Encoding.Unicode, Encoding.ASCII,
temp1);
strOutput = new string(Encoding.ASCII.GetChars(temp2));

Am I missing some steps?
Jul 21 '05 #1
4 2401
Hi,

Do you think the following is what you want?

strOutput = System.Web.HttpUtility.UrlEncode(strInput);

If you have any Qs, please reply to this post.

--
Parker Zhang
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.

Jul 21 '05 #2
Thanks Packer, this works perfectly.

However what is the proper steps for using the Encoding
namespace? I would like to learn a flexible way to convert
string between different "encoding format".

Thanks in advance,
-----Original Message-----
Hi,

Do you think the following is what you want?

strOutput = System.Web.HttpUtility.UrlEncode(strInput);

If you have any Qs, please reply to this post.

--
Parker Zhang
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
.

Jul 21 '05 #3
Daniel <da*********@asbbank.co.nz> wrote:
Thanks Packer, this works perfectly.

However what is the proper steps for using the Encoding
namespace? I would like to learn a flexible way to convert
string between different "encoding format".


The Encoding namespace is for converting between text and binary
formats - it's nothing to do with the URL encoding you're using here
(which is text->text).

See http://www.pobox.com/~skeet/csharp/unicode.html for more
information.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #4
oic. I misunderstood. Thanks for clarifying.
-----Original Message-----
Daniel <da*********@asbbank.co.nz> wrote:
Thanks Packer, this works perfectly.

However what is the proper steps for using the Encoding
namespace? I would like to learn a flexible way to convert string between different "encoding format".
The Encoding namespace is for converting between text and

binaryformats - it's nothing to do with the URL encoding you're using here(which is text->text).

See http://www.pobox.com/~skeet/csharp/unicode.html for moreinformation.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
.

Jul 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
by: Hallvard B Furuseth | last post by:
Has someone got a Python routine or module which converts Unicode strings to lowercase (or uppercase)? What I actually need to do is to compare a number of strings in a case-insensitive manner,...
22
by: Keith MacDonald | last post by:
Hello, Is there a portable (at least for VC.Net and g++) method to convert text between wchar_t and char, using the standard library? I may have missed something obvious, but the section on...
0
by: Jonathan | last post by:
I have a unicode database and I basically wish to publish out certain data (via views) from it to a non unicode database. Unfortunately we can not change the type of either of the databases due to...
16
by: ^_^ | last post by:
conversion from: a="a"; to a=0x????; If there are many unicode strings to convert, how can I do batch-conversion?
6
by: New MSSQL DBA | last post by:
Hi all, we are now planning to upgrade our application from a non-unicode version to a unicode version. The application's backend is a SQL Server 2000 SP3. The concern is, existing business...
32
by: Wolfgang Draxinger | last post by:
I understand that it is perfectly possible to store UTF-8 strings in a std::string, however doing so can cause some implicaions. E.g. you can't count the amount of characters by length() | size()....
18
by: Ger | last post by:
I have not been able to find a simple, straight forward Unicode to ASCII string conversion function in VB.Net. Is that because such a function does not exists or do I overlook it? I found...
4
by: Daniel | last post by:
Hi, I would like to do something like this Input: http://www.test.com/ to Output: http%3A%2F%2Fwww.test.com%2F
9
by: mistral | last post by:
Is there some Unicode converter to convert javascript to Unicode format? thanks mistral
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.