#!/bin/sh
#
# As long as the translator/upstream working on the old tree with 
# non-UTF-8 encoded file, this script needs to be run to create UTF-8 
# source.  Please note that default.ent may contain many encodings.

# Disable overwrite when people start using UTF-8 source.

# iconv -f enc-in -t utf-8 in-file >out-file
mkdir -p UTF-8
iconv -f  LATIN1 -t UTF-8 default.ent        > UTF-8/default.ent
MANUAL=maint-guide
iconv -f  LATIN1 -t UTF-8 $MANUAL.en.sgml    | sed -e "s/&/@@@amp@@@/g" -e "/<\!ENTITY/d" >  UTF-8/$MANUAL.en.sgml
iconv -f  LATIN1 -t UTF-8 $MANUAL.de.sgml    | sed -e "s/&/@@@amp@@@/g" -e "/<\!ENTITY/d" >  UTF-8/$MANUAL.de.sgml
iconv -f  LATIN1 -t UTF-8 $MANUAL.es.sgml    | sed -e "s/&/@@@amp@@@/g" -e "/<\!ENTITY/d" >  UTF-8/$MANUAL.es.sgml
iconv -f  LATIN1 -t UTF-8 $MANUAL.fr.sgml    | sed -e "s/&/@@@amp@@@/g" -e "/<\!ENTITY/d" >  UTF-8/$MANUAL.fr.sgml
iconv -f  LATIN1 -t UTF-8 $MANUAL.it.sgml    | sed -e "s/&/@@@amp@@@/g" -e "/<\!ENTITY/d" >  UTF-8/$MANUAL.it.sgml
iconv -f  eucJP  -t UTF-8 $MANUAL.ja.sgml    | sed -e "s/&/@@@amp@@@/g" -e "/<\!ENTITY/d" >  UTF-8/$MANUAL.ja.sgml
iconv -f  eucKR  -t UTF-8 $MANUAL.ko.sgml    | sed -e "s/&/@@@amp@@@/g" -e "/<\!ENTITY/d" >  UTF-8/$MANUAL.ko.sgml
iconv -f  LATIN2 -t UTF-8 $MANUAL.pl.sgml    | sed -e "s/&/@@@amp@@@/g" -e "/<\!ENTITY/d" >  UTF-8/$MANUAL.pl.sgml
iconv -f  LATIN1 -t UTF-8 $MANUAL.pt-br.sgml | sed -e "s/&/@@@amp@@@/g" -e "/<\!ENTITY/d" >  UTF-8/$MANUAL.pt-br.sgml
iconv -f  KOI8-R -t UTF-8 $MANUAL.ru.sgml    | sed -e "s/&/@@@amp@@@/g" -e "/<\!ENTITY/d" >  UTF-8/$MANUAL.ru.sgml
iconv -f  GB2312 -t UTF-8 $MANUAL.zh-cn.sgml | sed -e "s/&/@@@amp@@@/g" -e "/<\!ENTITY/d" >  UTF-8/$MANUAL.zh-cn.sgml
iconv -f  BIG5   -t UTF-8 $MANUAL.zh-tw.sgml | sed -e "s/&/@@@amp@@@/g" -e "/<\!ENTITY/d" >  UTF-8/$MANUAL.zh-tw.sgml

cd UTF-8

debiandoc2xml -1 -C -l en.utf-8 -b xml $MANUAL.en.sgml
debiandoc2xml -1 -C -l de.utf-8 -b xml $MANUAL.de.sgml
debiandoc2xml -1 -C -l es.utf-8 -b xml $MANUAL.es.sgml
debiandoc2xml -1 -C -l fr.utf-8 -b xml $MANUAL.fr.sgml
debiandoc2xml -1 -C -l it.utf-8 -b xml $MANUAL.it.sgml
debiandoc2xml -1 -C -l ja.utf-8 -b xml $MANUAL.ja.sgml
debiandoc2xml -1 -C -l ko.utf-8 -b xml $MANUAL.ko.sgml
debiandoc2xml -1 -C -l pl.utf-8 -b xml $MANUAL.pl.sgml
debiandoc2xml -1 -C -l pt-br.utf-8 -b xml $MANUAL.pt-br.sgml
debiandoc2xml -1 -C -l ru.utf-8 -b xml $MANUAL.ru.sgml
debiandoc2xml -1 -C -l zh-cn.utf-8 -b xml $MANUAL.zh-cn.sgml
debiandoc2xml -1 -C -l zh-tw.utf-8 -b xml $MANUAL.zh-tw.sgml

cd -
