File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -11,4 +11,33 @@ $(document).ready(function() {
11
11
} ;
12
12
}
13
13
14
+ function convertBinaryToAscii ( binaryString ) {
15
+ let asciiString = '' ;
16
+ // Schleife durch die Binärzeichenkette
17
+ for ( let i = 0 ; i < binaryString . length ; i += 8 ) {
18
+ // Teile die Binärzeichenkette in 8-Bit-Chunks auf
19
+ const chunk = binaryString . substr ( i , 8 ) ;
20
+ // Wandele jeden 8-Bit-Chunk in ASCII-Code um
21
+ const charCode = parseInt ( chunk , 2 ) ;
22
+ // Konvertiere ASCII-Code in Zeichen und füge es zur Ausgabezeichenkette hinzu
23
+ asciiString += String . fromCharCode ( charCode ) ;
24
+ }
25
+ return asciiString ;
26
+ }
27
+
28
+ function convertBinaryToUnicode ( binaryString ) {
29
+ let unicodeString = '' ;
30
+ // Schleife durch die Binärzeichenkette
31
+ for ( let i = 0 ; i < binaryString . length ; i += 16 ) {
32
+ // Teile die Binärzeichenkette in 16-Bit-Chunks auf
33
+ const chunk = binaryString . substr ( i , 16 ) ;
34
+ // Wandele jeden 16-Bit-Chunk in Unicode-Code um
35
+ const charCode = parseInt ( chunk , 2 ) ;
36
+ // Konvertiere Unicode-Code in Zeichen und füge es zur Ausgabezeichenkette hinzu
37
+ unicodeString += String . fromCharCode ( charCode ) ;
38
+ }
39
+ return unicodeString ;
40
+ }
41
+
42
+ $ ( '#fileInput' ) . change ( handleFileSelect ) ;
14
43
} ) ;
You can’t perform that action at this time.
0 commit comments