Convert code point to Unicode character

Script key: Convert code point to Unicode character

Posted by @edgauthier

Install

Details

Label
Voice Over Convert code point to Unicode character
Script
// Script keys run short Javascripts
// For documentation and examples, visit:
// http://help.agiletortoise.com

if (!String.fromCodePoint) {
// ES6 Unicode Shims 0.1 , © 2012 Steven Levithan http://slevithan.com/ , MIT License
    String.fromCodePoint = function fromCodePoint () {
        var chars = [], point, offset, units, i;
        for (i = 0; i < arguments.length; ++i) {
            point = arguments[i];
            offset = point - 0x10000;
            units = point > 0xFFFF ? [0xD800 + (offset >> 10), 0xDC00 + (offset & 0x3FF)] : [point];
            chars.push(String.fromCharCode.apply(null, units));
        }
        return chars.join("");
    }
}

var input = getSelectedText()
var output = String.fromCodePoint(parseInt(input,16))
setSelectedText(output)

Advanced

Keyboard shortcut None
Hide key Yes

Discussion

comments powered by Disqus