JSFiddle - React, Tailwind, and code Playground
by jrunning
CSS
body{font-family:monospace}
JavaScript
const ESCAPE_SEQUENCE_EXPR = /\\X2\\(.*?)\\X0\\/g;
function decodeIfc(str) {
return str.replace(ESCAPE_SEQUENCE_EXPR, () =>
RegExp.$1.replace(/..../, () =>
String.fromCodePoint(parseInt(RegExp.lastMatch, 16))
)
);
}
const input = 'S\\X2\\00E9\\X0\\jour/Cuisine';
const output = decodeIfc(str);
document.body.innerHTML = `
Input: ${str}<br>
Output: ${decodeIfc(str)}
`;