#!/bin/sh exec > utf8tab.h echo "// Automatically generated from genutf8tab.sh"; echo "//" echo "// This is not done by the makefile because genutf8tab.sh has" echo "// some dependencies and it is very likely that the character" echo "// set mappings described here will never change.." echo for x in ISO8859-1; do echo "static unsigned char UTF8TAB_${x//-/_}[128][4] = {" perl -le 'print chr($_) for (128..255);' | iconv -f ISO8859-1 -t utf-8 | perl -le 'for ($i=128; <>; $i++) { chomp; s/(.)/ord($1).","/ge; s%(.*)% " { ${1}0 }".($i<255 ? "," : " ")." // $i"%e; print; }' echo "};"; echo done