Solved

Converting between utf-8 and utf-16

Posted on 2004-08-03
7
729 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
  • 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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

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 125 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

759 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now