Commit 4de74628 authored by Laurent Wouters's avatar Laurent Wouters
Browse files

[fix] Fixing issue with URI handling

parent c95c5239e5b5
......@@ -31,15 +31,22 @@ function uriUnicodeEscape(uri: string): string {
if (cc >= 0x80) {
let offset = cc >= 0xd800 && cc <= 0xdbff ? 1 : 0;
let cp = uri.codePointAt(i);
let cpAsString = cp === undefined ? "" : cp.toString(16).toUpperCase();
result += "\\u";
let leading = 4 + offset * 4 - cpAsString.length;
while (leading > 0) {
result += "0";
leading--;
if (cp === undefined) {
console.log(
"Failed to identify codepoint at " + i + " in '" + uri + '"'
);
i += 1;
} else {
let cpAsString = cp.toString(16).toUpperCase();
result += "\\u";
let leading = 4 + offset * 4 - cpAsString.length;
while (leading > 0) {
result += "0";
leading--;
}
result += cpAsString;
i += offset;
}
result += cp;
i += offset;
} else {
result += uri.charAt(i);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment