File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change 11<!DOCTYPE html>
22< html lang ="en-GB "> <!-- https://github.com/cpp-tutor/pseudocode-compiler/ -->
33< head >
4- < meta charset =" UTF-8 ">
4+ < meta http-equiv =" Content-type " content =" text/html;charset= UTF-8 ">
55< title > Pseudocode to JavaScript Compiler</ title >
66< meta name ="viewport " content ="width=device-width, initial-scale=1 ">
77< link href ="pscweb.css " type ="text/css " rel ="stylesheet " />
1414< h2 align ="center "> Pseudocode to JavaScript Compiler</ h2 >
1515</ div >
1616< div class ="window ">
17- < form id ="input ">
17+ < form id ="input " accept-charset =" utf-8 " >
1818< label for ="program_source_id "> < h3 align ="center "> Type your program in here</ h3 >
1919< textarea name ="program_source "> </ textarea >
2020</ label >
Original file line number Diff line number Diff line change @@ -36,9 +36,17 @@ function clear_output() {
3636 document . getElementById ( 'program_output' ) . innerHTML = '' ;
3737}
3838
39- function base64enc ( rawutf8 ) {
39+ function toutf8 ( str ) {
40+ var urifmt = '' + encodeURIComponent ( str ) , x = function ( s ) {
41+ return String . fromCharCode ( parseInt ( s . substring ( 1 ) , 16 ) ) ;
42+ }
43+ return urifmt . replace ( / % ../ g, x ) ;
44+ }
45+
46+ function base64enc ( input ) {
4047 let encweb = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=' ;
41- var enc = '' , pos = 0 , len = rawutf8 . length ;
48+ var rawutf8 = toutf8 ( input ) , enc = '' , pos = 0 ;
49+ let len = rawutf8 . length ;
4250 while ( ( len - pos ) > 2 ) {
4351 enc += encweb [ ( rawutf8 . charCodeAt ( pos ) >> 2 ) & 0x3f ] ;
4452 enc += encweb [ ( ( rawutf8 . charCodeAt ( pos ) << 4 ) | ( rawutf8 . charCodeAt ( pos + 1 ) >> 4 ) ) & 0x3f ] ;
You can’t perform that action at this time.
0 commit comments