Solved

Converting between utf-8 and utf-16

Posted on 2004-08-03
7
734 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 

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

Independent Software Vendors: 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!

Question has a verified solution.

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

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…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

691 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