Skip to content

Instantly share code, notes, and snippets.

@haakym
Created March 22, 2017 11:58
Show Gist options
  • Save haakym/c00ed074a1d730e803e2a71ba51551f5 to your computer and use it in GitHub Desktop.
Save haakym/c00ed074a1d730e803e2a71ba51551f5 to your computer and use it in GitHub Desktop.
String to Hex for ZPL in JS
function stringToHex(str) {
return str.split('').map(function (char) {
return '_' + char.charCodeAt(0).toString(16);
}).join('');
}
console.log(stringToHex('ش')); // _d8_b4
@haakym
Copy link
Author

haakym commented Mar 22, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment