Use codePointAt/fromCodePoint instead of charCodeAt/fromCharCode (S7758)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -13,7 +13,7 @@ export function encodeReturnTo(returnToPath) {
|
|||||||
const bytes = new TextEncoder().encode(returnToPath);
|
const bytes = new TextEncoder().encode(returnToPath);
|
||||||
let binary = "";
|
let binary = "";
|
||||||
bytes.forEach((byte) => {
|
bytes.forEach((byte) => {
|
||||||
binary += String.fromCharCode(byte);
|
binary += String.fromCodePoint(byte);
|
||||||
});
|
});
|
||||||
return btoa(binary);
|
return btoa(binary);
|
||||||
}
|
}
|
||||||
@@ -25,6 +25,6 @@ export function encodeReturnTo(returnToPath) {
|
|||||||
*/
|
*/
|
||||||
export function decodeReturnTo(encodedReturnTo) {
|
export function decodeReturnTo(encodedReturnTo) {
|
||||||
const binary = atob(encodedReturnTo);
|
const binary = atob(encodedReturnTo);
|
||||||
const bytes = Uint8Array.from(binary, (char) => char.charCodeAt(0));
|
const bytes = Uint8Array.from(binary, (char) => char.codePointAt(0));
|
||||||
return new TextDecoder().decode(bytes);
|
return new TextDecoder().decode(bytes);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user