Closed bastien-roucaries closed 8 years ago
On debian side we use the following script to generate data.js and save some bandwith
#!/usr/bin/env nodejs lpad = function(str, padString, length) { while (str.length < length) str = padString + str; return str; } s = require("sprintf-js"); process.stdout.write("// All Unicode symbols from U+000000 to U+10FFFF\n"); process.stdout.write("module.exports = [\n"); process.stdout.write("\t'\\0',\n"); for(i=1;i<=0x2F;i++) process.stdout.write(s.sprintf("\t'\\x%s',\n",lpad(s.sprintf("%X",i),'0',2))); for(i=0x2F+1;i<0x3A;i++) process.stdout.write(s.sprintf("\t'%c',\n",i)); for(i=0x3A;i<=0x40;i++) process.stdout.write(s.sprintf("\t'\\x%X',\n",i)); for(i=0x40+1;i<0x5B;i++) process.stdout.write(s.sprintf("\t'%c',\n",i)); for(i=0x5B;i<=0x60;i++) process.stdout.write(s.sprintf("\t'\\x%s',\n",lpad(s.sprintf("%X",i),'0',2))); for(i=0x60+1;i<0x7B;i++) process.stdout.write(s.sprintf("\t'%c',\n",i)); for(i=0x7B;i<=0xFF;i++) process.stdout.write(s.sprintf("\t'\\x%s',\n",lpad(s.sprintf("%X",i),'0',2))); for(i=0x100;i<=0xFFFF;i++) process.stdout.write(s.sprintf("\t'\\u%s',\n",lpad(s.sprintf("%X",i),'0',4))); for(j=0xD800;j<=0xDBFE;j++) for(i=0xDC00;i<=0xDFFF;i++) process.stdout.write(s.sprintf("\t'\\u%s\\u%s',\n",lpad(s.sprintf("%X",j),'0',4), lpad(s.sprintf("%X",i),'0',4))); for(j=0xDBFF;j<=0xDBFF;j++) for(i=0xDC00;i<=0xDFFE;i++) process.stdout.write(s.sprintf("\t'\\u%s\\u%s',\n",lpad(s.sprintf("%X",j),'0',4), lpad(s.sprintf("%X",i),'0',4))); process.stdout.write(s.sprintf("\t'\\u%s\\u%s'\n",lpad(s.sprintf("%X",0xDBFF),'0',4), lpad(s.sprintf("%X",0xDFFF),'0',4))); process.stdout.write('];');
data.js is now removed from the repo and no longer being used in the tests.
data.js
On debian side we use the following script to generate data.js and save some bandwith