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
Solved

Converting between utf-8 and utf-16

Posted on 2004-08-03
7
732 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
JSON error 4 71
is this a cms? 8 67
Save ms data to server side. 19 55
Passing Parameter to Stored Procedure 4 27
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

839 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