?
Solved

Converting between utf-8 and utf-16

Posted on 2004-08-03
7
Medium Priority
?
737 Views
Last Modified: 2008-03-10
Hi,
Could any body please provide me with some instructions on how to
 convert between utf-8 and utf-16 using ASP.... not ASP.NET

A code snippet would be really helpful.

thanks.
0
Comment
Question by:sukhdev
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 5

Expert Comment

by:cristy56
ID: 11712230
<%@codepage=1220%>
and the charset for the asp file will be set to charset=utf-16.


Cristy
0
 
LVL 5

Expert Comment

by:cristy56
ID: 11712243
oh, sorry, should be <%@ codepage=1200 %>

Cristy
0
 

Author Comment

by:sukhdev
ID: 11723271
Hi,

Thanks for replying.... but the method you suggested would theoretically convert all the data on the page to utf-16,
which is not exactly what i wanted... but somehow... asp doesn't do that...

Anyway, leaving other details apart......

What i needed was... i wanted to convert my text (utf-8) to utf-16... and just wanted to inform you that
I was actually able to find an algorithm which
takes an input string and converts to utf-8 or utf-16, depending on what you want.

Thanks anyway for trying to help.
cheers.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:sukhdev
ID: 11723285
Regarding the points...

Because I found the answer else where  but at the same time you tried to help me...
I would offer some of the points to you (maybe about 50)... but not sure whether can decrease the points...

However, i have yet another question... and would offer you the total points if you could give me the solution to that question.

My new question
---------------------
Q. How to I convert a string to binary data in asp (not asp.net)?

Thanks

cheers,
0
 
LVL 5

Accepted Solution

by:
cristy56 earned 375 total points
ID: 11723542

Dim mytext() As Char = "This is a test"
Dim c As Char, s,bs As String, i as Integer

' string to binary

For Each c In mytext
     s += Integer.Parse(Convert.ToString(Asc(c), 2)).ToString("00000000")
Next

MessageBox.Show("Converted to binary: " & s)

' binary to string

For i = 0 To s1.Length - 1 Step 8
      bs += Chr((Convert.ToByte(s.Substring(i, 8), 2)))
Next
MessageBox.Show("Converted back to String: " & bs)


-----------------------------------------------------------------------------------

Cristy
0
 

Author Comment

by:sukhdev
ID: 11749512
The code you provided looks like an asp.net code....
what I'm looking for is asp code, not asp.net

I need to convert a string to byte array in asp.

thanks.
0
 

Author Comment

by:sukhdev
ID: 11831110
Hi

I have tried the code you gave me.....
it's a .NET code... what i was looking for is an asp code (not .net)

Your code works for .NET... maybe I could use this later for some other project.

However, I've found a way to do the conversion in asp..... I've decided to use an asp component which does that.

Regarding the points, because you tried to help me, and came up with something i could use later... and because I'm a pretty good mood today... I've changed my mind and decided to award all the points to you.

cheers,
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question