ANSI,PSC,Converts,from,Unicode,very,fast,Insp
Quick Search for: in language:   
ANSI,PSC,Converts,from,Unicode,very,fast,Insp
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
ASP/ VbScript Stats

 Code: 101,137 lines
 Jobs: 277 postings

 

You are in:

 
Login


 

 

Latest Code Ticker for ASP/ VbScript
Click here to see a screenshot of this code!Online Database Editor
By Andy T. on 3/18

(Screen Shot)

What is going on on PSCode.com?!?!
By Timothy Beutels on 3/18


Write out time for different time zones [8:24:18 PM]
By snowboardr on 3/18


Click here to see a screenshot of this code!Picture Upload/View
By John Overton on 3/17

(Screen Shot)

Variables in #INCLUDE FILE
By Drew Gulbransen on 3/17


Unbreakable Password Protection
By Rahul Mahajan on 3/17


Click here to see a screenshot of this code!Instant Connect
By John Overton on 3/16

(Screen Shot)

Click here to see a screenshot of this code!Folder Interface
By Lewis Moten on 3/16

(Screen Shot)

Click here to see a screenshot of this code!ASP XML Calendar
By John Overton on 3/15

(Screen Shot)

Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!





Affiliate Sites



 
 

 
 

   

ANSI to Unicode

Print
Email
 
VB icon
Submitted on: 2/25/2002 12:08:12 PM
By: Lewis Moten  
Level: Advanced
User Rating: By 1 Users
Compatibility:ASP (Active Server Pages), VbScript (browser/client side)

Users have accessed this code 501 times.
 

(About the author)
 
     Converts from ANSI to Unicode very fast. Inspired by code found in UltraFastAspUpload by Cakkie (on PSC). This should work slightly faster then Cakkies due to how some of the code has been arranged.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for langauges that allow it) freely and with no charge.   
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.

    '**************************************
    ' Name: ANSI to Unicode
    ' Description:Converts from ANSI to Unic
    '     ode very fast. Inspired by code found in
    '     UltraFastAspUpload by Cakkie (on PSC). T
    '     his should work slightly faster then Cak
    '     kies due to how some of the code has bee
    '     n arranged.
    ' By: Lewis Moten
    '
    'This code is copyrighted and has    ' limited warranties.Please see http://w
    '     ww.Planet-Source-Code.com/xq/ASP/txtCode
    '     Id.7266/lngWId.4/qx/vb/scripts/ShowCode.
    '     htm    'for details.    '**************************************
    
    <%
    ' make a sample binary string of 2000 ra
    '     ndom letters
    Dim test
    Dim c
    For i = 1 To 2000
    	c = 65 + Int(Rnd * 25)
    	test = test & ChrB(AscB(Chr(c)))
    	if i Mod 4 = 0 Then
    		test = test & ChrB(AscB(" "))
    	End if
    Next
    Response.Write ANSIToUnicode(test)
    function ANSIToUnicode(ByRef pbinBinaryData)
    	Dim lbinData	' Binary Data (ANSI)
    	Dim llngLength	' Length of binary data (byte count)
    	Dim lobjRs		' Recordset
    	Dim lstrData	' Unicode Data
    	' VarType Reference
    	'8 = Integer (this is expected var type)
    	'17 = Byte Subtype
    	' 8192 = Array
    	' 8209 = Byte Subtype + Array
    	Set lobjRs = Server.CreateObject("ADODB.Recordset")
    	if VarType(pbinBinaryData) = 8 Then
    		' Convert integers(4 bytes) To Byte Subtype Array (1 byte)
    		llngLength = LenB(pbinBinaryData)
    		if llngLength = 0 Then
    			lbinData = ChrB(0)
    		Else
    			Call lobjRs.Fields.Append("BinaryData", adLongVarBinary, llngLength)
    			Call lobjRs.Open()
    			Call lobjRs.AddNew()
    			Call lobjRs.Fields("BinaryData").AppendChunk(pbinBinaryData & ChrB(0)) ' + Null terminator
    			Call lobjRs.Update()
    			lbinData = lobjRs.Fields("BinaryData").GetChunk(llngLength)
    			Call lobjRs.Close()
    		End if
    	Else
    		lbinData = pbinBinaryData
    	End if
    	' Do REAL conversion now!	
    	llngLength = LenB(lbinData)
    	if llngLength = 0 Then
    		lstrData = ""
    	Else
    		Call lobjRs.Fields.Append("BinaryData", adLongVarChar, llngLength)
    		Call lobjRs.Open()
    		Call lobjRs.AddNew()
    		Call lobjRs.Fields("BinaryData").AppendChunk(lbinData)
    		Call lobjRs.Update()
    		lstrData = lobjRs.Fields("BinaryData").Value
    		Call lobjRs.Close()
    	End if
    	Set lobjRs = Nothing
    	ANSIToUnicode = lstrData
    End function
    %>


Other 73 submission(s) by this author

 

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this code(in the Advanced category)?
(The codewith your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments

 There are no comments on this submission.
 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | ASP/ VbScript Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.