Created
April 25, 2016 14:56
-
-
Save ppoffice/e3f603a15139a1475fe3181daa97b3ad to your computer and use it in GitHub Desktop.
Unicode Garbled Text Decoder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = '\xE7\xBB\xBF\xE8\x89\xB2\xE5\x81\xA5\xE5\xBA\xB7\xE5\xB0\x8F\xE6\xB8\x85\xE6\x96\xB0'; | |
x.split('').map(i => (j = i.charCodeAt(0).toString(2), i.charCodeAt(0) > 127 ? j : new Array((4 - (j.length % 4)) % 4).fill('0').join('') + j)).map((i, j, k) => (l = i.match(/^0|^1{2,4}0/), l ? m = new Array(l[0] === '0' ? 1 : l[0].length - 1).fill(0) : m = [], m.map((o, r) => r === 0 ? i.slice(l[0].length, i.length) : k[j + r].slice(2, k[j + r].length)))).filter(i => i.length).map(i => String.fromCharCode(parseInt(i.join(''), 2))).join(''); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment