Skip to content

Commit 9803596

Browse files
committed
STASH - need to account for other vendors
1 parent b138430 commit 9803596

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

packages/utils/src/string.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,3 +196,35 @@ export function UnicodeToBase64(unicodeString: string): string {
196196
}`,
197197
);
198198
}
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);

0 commit comments

Comments
 (0)