Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > decode base64 string

Reply
Thread Tools

decode base64 string

 
 
Guoqi Zheng
Guest
Posts: n/a
 
      09-26-2004
Hi,

Any one has a code example of how to decode base64 string?


I used below function but it does not work correctly, especially when I need
to decode some Characters like Chinese,

Can some one give an example or point out what I did wrong here? Thanks.


Public Function DecodeBase64(ByVal strInput As String) As String

Dim ReturnByte As Byte()

ReturnByte = System.Convert.FromBase64String(strInput)

Dim ReturnString As String

ReturnString = System.Text.Encoding.UTF8.GetString(ReturnByte)

Return ReturnString

End Function


 
Reply With Quote
 
 
 
 
Rick Strahl [MVP]
Guest
Posts: n/a
 
      09-27-2004
UTF8 might not work for high bit character sets like Chines. You'll want to
use Unicode encoding or the specific code page for the language in question.

+++ Rick ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/weblog/
http://www.west-wind.com/wwThreads/
----------------------------------
Making waves on the Web


"Guoqi Zheng" <(E-Mail Removed)> wrote in message
news:OhgCgY$(E-Mail Removed)...
> Hi,
>
> Any one has a code example of how to decode base64 string?
>
>
> I used below function but it does not work correctly, especially when I

need
> to decode some Characters like Chinese,
>
> Can some one give an example or point out what I did wrong here? Thanks.
>
>
> Public Function DecodeBase64(ByVal strInput As String) As String
>
> Dim ReturnByte As Byte()
>
> ReturnByte = System.Convert.FromBase64String(strInput)
>
> Dim ReturnString As String
>
> ReturnString = System.Text.Encoding.UTF8.GetString(ReturnByte)
>
> Return ReturnString
>
> End Function
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FAQ 9.18 How do I decode a MIME/BASE64 string? PerlFAQ Server Perl Misc 0 04-07-2011 04:00 PM
decode base64 encoded login info Mr. T ASP .Net 1 03-05-2007 03:47 PM
Decode a PNG image from Base64 =?Utf-8?B?QmVnaW5uZXI=?= ASP .Net 0 03-09-2006 10:04 PM
base64.encode and decode not correct Damir Hakimov Python 1 08-16-2005 04:22 PM
Re: base64.encode and decode not correct jepler@unpythonic.net Python 0 08-16-2005 12:53 PM



Advertisments