[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 743
  • Last Modified:

Converting between utf-8 and utf-16

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
sukhdev
Asked:
sukhdev
  • 4
  • 3
1 Solution
 
cristy56Commented:
<%@codepage=1220%>
and the charset for the asp file will be set to charset=utf-16.


Cristy
0
 
cristy56Commented:
oh, sorry, should be <%@ codepage=1200 %>

Cristy
0
 
sukhdevAuthor Commented:
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
sukhdevAuthor Commented:
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
 
cristy56Commented:

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
 
sukhdevAuthor Commented:
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
 
sukhdevAuthor Commented:
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

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.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now