473,394 Members | 1,810 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,394 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 2404
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:
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
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.