#!/bin/sh # Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # References: # https://encoding.spec.whatwg.org/#euc-kr # This script downloads the following file. # https://encoding.spec.whatwg.org/index-euc-kr.txt function preamble { cat < "euc-kr-html" 2 1 "MBCS" \x3F "ASCII" # 81-fe in states 2 and 3 can be tigher and a1-fe, but # to be compliant to HTML5 spec, it should be 81-fe. 0-7f, 81-c5:1, c6:2, c7-fe:3 41-5a, 61-7a, 81-fe 41-52, 81-fe 81-fe CHARMAP PREAMBLE } function ascii { for i in $(seq 0 127) do printf ' \\x%02X |0\n' $i $i done } # HKSCS characters are not supported in encoding ( |lead < 0xA1| ) function euckr { awk '!/^#/ && !/^$/ \ { pointer = $1; \ ucs = substr($2, 3); \ lead = pointer / 190 + 0x81; \ trail = $1 % 190 + 0x41; \ tag = 0; \ printf (" \\x%02X\\x%02X |%d\n", ucs,\ lead, trail, tag);\ }' \ index-euc-kr.txt } function unsorted_table { euckr } wget -N -r -nd https://encoding.spec.whatwg.org/index-euc-kr.txt preamble ascii unsorted_table | sort -k1 | uniq echo 'END CHARMAP'