473,396 Members | 1,914 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

is there a UUDecode function available in JavaScript?

Does anyone know if there is a UUDecode function available to JavaScript

john
Sep 7 '12 #1
2 6878
gits
5,390 Expert Mod 4TB
there is a implementation https://github.com/kvz/phpjs/blob/ma...rt_uudecode.js for example. there is no built in method - but by searching the web you might find more implementations for it.
Sep 7 '12 #2
code from the above link not work properly. able to get code from some other location and the perfect work code is as follows

Expand|Select|Wrap|Line Numbers
  1. function decode64(input) {
  2.  
  3.     var keyStr = "ABCDEFGHIJKLMNOP" +
  4.     "QRSTUVWXYZabcdef" +
  5.     "ghijklmnopqrstuv" +
  6.     "wxyz0123456789+/" +
  7.     "=";
  8.  
  9.     var output = "";
  10.  
  11.     var chr1, chr2, chr3 = "";
  12.  
  13.     var enc1, enc2, enc3, enc4 = "";
  14.  
  15.     var i = 0;
  16.  
  17.     // remove all characters that are not A-Z, a-z, 0-9, +, /, or =
  18.  
  19.     var base64test = /[^A-Za-z0-9\+\/\=]/g;
  20.  
  21.     if (base64test.exec(input)) {
  22.  
  23.         alert("There were invalid base64 characters in the input text.\n" +
  24.  
  25.         "Valid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='\n" +
  26.  
  27.         "Expect errors in decoding.");
  28.  
  29.     }
  30.  
  31.     input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
  32.  
  33.     do {
  34.  
  35.         enc1 = keyStr.indexOf(input.charAt(i++));
  36.  
  37.         enc2 = keyStr.indexOf(input.charAt(i++));
  38.  
  39.         enc3 = keyStr.indexOf(input.charAt(i++));
  40.  
  41.         enc4 = keyStr.indexOf(input.charAt(i++));
  42.  
  43.         chr1 = (enc1 << 2) | (enc2 >> 4);
  44.  
  45.         chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
  46.  
  47.         chr3 = ((enc3 & 3) << 6) | enc4;
  48.  
  49.         output = output + String.fromCharCode(chr1);
  50.  
  51.         if (enc3 != 64) {
  52.  
  53.             output = output + String.fromCharCode(chr2);
  54.  
  55.         }
  56.  
  57.         if (enc4 != 64) {
  58.  
  59.             output = output + String.fromCharCode(chr3);
  60.  
  61.         }
  62.  
  63.         chr1 = chr2 = chr3 = "";
  64.  
  65.         enc1 = enc2 = enc3 = enc4 = "";
  66.  
  67.  
  68.  
  69.     } while (i < input.length);
  70.  
  71.  
  72.     return decodeURI(output);
  73.  
  74. }
Sep 13 '12 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Cathryn Lindner | last post by:
I am building a web application. On the form, I have a checkbox that needs to display a drop down list when checked. The drop down list is populated by a function in a dll that is registered in...
4
by: Matt | last post by:
I want to confirm there is not built-in trim() function in javascript. If I need one, I need to implement my own needs. please advise. Thanks!!
4
by: Steven | last post by:
Hello, How to call a C# function (eg., main()) from a Javascript funtion (eg., ref()). -- Steven
4
by: KK | last post by:
Hi, Does anybody know how to call server side function in javascript? Suppose I've a method named Test() at code behind of ASP.Net page. How can I call that method in javascript function ???...
3
by: Tanmaya Kulkarni | last post by:
Hi, I have a web application where I need to call backend C#/VB.Net functions from javascript. Is it possible..and how? Thanks, Tanmaya
1
nirmalsingh
by: nirmalsingh | last post by:
i have tried many ways to call a C# function through javascript. but i couldn't. i'll be more thankful if any one help me with sample code...
5
by: teenIce | last post by:
Hi guys, How do I access flash function using javascript?Does anyone have any reference or code? Thanks...
1
by: jerin | last post by:
Hi, I dont know "how to call a serverside function through javascript".When i tried to call the function like this: <%=FillAnmID() %> where FillAnmID is the server side function. I got a...
1
by: vartana | last post by:
how can i call a none static function using javascript? javascript:GetData() Public Sub GetData() Dim objNL As New NLEngine Dim dtNewsList As New Data.DataTable ...
1
by: visweswaran2830 | last post by:
Hi, I have a function in aspx.vb (code behind fucntion). Now I want to call this function using javascript... How can I call?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.