File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -196,3 +196,35 @@ export function UnicodeToBase64(unicodeString: string): string {
196
196
} `,
197
197
) ;
198
198
}
199
+
200
+ // let unicode = 'dogs are great ♥️🐶';
201
+ let unicode = JSON . stringify ( {
202
+ environment : 'dogpark🐶🌳' ,
203
+ public_key : 'dogsarebadatkeepingsecrets' ,
204
+ release : 'off.leash.park' ,
205
+ trace_id : '0908201304152013' ,
206
+ } ) ;
207
+ let binary = unicodeToBinary ( unicode ) ;
208
+ let base64 = Buffer . from ( binary , 'binary' ) . toString ( 'base64' ) ;
209
+
210
+ console . log ( unicode ) ;
211
+ console . log ( binary ) ;
212
+ console . log ( base64 ) ;
213
+
214
+ binary = Buffer . from ( base64 , 'base64' ) . toString ( 'binary' ) ;
215
+ unicode = binaryToUnicode ( binary ) ;
216
+
217
+ console . log ( binary ) ;
218
+ console . log ( unicode ) ;
219
+
220
+ console . log ( '------' ) ;
221
+
222
+ console . log ( unicode ) ;
223
+
224
+ base64 = Buffer . from ( unicode , 'utf16le' ) . toString ( 'base64' ) ;
225
+
226
+ console . log ( base64 ) ;
227
+
228
+ unicode = Buffer . from ( base64 , 'base64' ) . toString ( 'utf16le' ) ;
229
+
230
+ console . log ( unicode ) ;
You can’t perform that action at this time.
0 commit comments