Converting 7-bit ascii to 8-bit ascii
Posted in 1999
Topics: Installation, Setup & Upgrades, Platform-Specific Issues
Hello to all. In near future we want upgrade our old Database Informix 4.0 SE to a higher version (7.24) on a HP-UX 10.xx system. All data using 7-bit ascii code. Is there a tool available to convert these data to 8-bit ascii code??? Best regards Dirk Emmermacher
Dirk Emmermacher <NDSTURNERBUND@t-online.de> wrote: > Hello to all. > In near future we want upgrade our old Database Informix 4.0 SE to a > higher version (7.24) on a HP-UX 10.xx system. All data using 7-bit > ascii code. Is there a tool available to convert these data to 8-bit > ascii code??? Depending on what you are going to do. If you're going to ISO-LATIN-1 then your data is OK. Although I guess that you are working in Germany. If such is true then your data is bound to contain Umlauts, RingelS (SS) etc, those are not 7 bit data. If you never the less put that in the database then you either have a propriate method or you have put 8 bit data in your database. And then the question get interesting. Which clients did you use to put in the data And in which mode were these clients? Best case you don't have to do any thing otherwise you probably get away with the tool recode from GNU Regards > Best regards > Dirk Emmermacher -- Rene de Zwart Phone +31 79 3616365 Indigoblauw 28 Fax +31 79 3620405 2718 JZ Zoetermeer Email wolfe!renez@relay.nl.net The Netherlands Email renez@LightCon.xs4all.nl
Dirk Emmermacher wrote:
> Is there a tool available to convert these data to 8-bit
> ascii code???
I did that with "sed". This can be found on any UNIX platform, and there
are implementations for other platforms (e.g. MKS toolkit for DOS/Windows).
When I did the server upgrade, I exported all data using the "dbexport"
utility and then ran a script that invoked sed for all of the generated
".unl" files:
for i in *.unl
do
sed -f umlaut.sed $i > $i.1
mv $i $i.2
mv $i.1 $i
done
I assume you have 7-bit German characters, so here is the sed script
"umlaut.sed" to convert these:
s/|/\\ö/g
s/\\\\\\\\/\\Ö/g
s/{/\\ä/g
s/\\[/\\Ä/g
s/}/\\ü/g
s/]/\\Ü/g
s/~/\\ß/g
Hope this helps,
Richard
--
+--------------------------+------------------------------------------+
| Dr. Richard Spitz | INTERNET: spitz@ana.med.uni-muenchen.de |
| EDV-Gruppe Anaesthesie | Tel : +49-89-7095-6110 <-- NEW! |
| Klinikum Grosshadern | FAX : +49-89-7095-8886 |
| 81366 Munich, Germany | GSM : +49-172-8933578 |
+--------------------------+------------------------------------------+
Richard Spitz wrote:
>
> Dirk Emmermacher wrote:
>
> > Is there a tool available to convert these data to 8-bit
> > ascii code???
>
> I did that with "sed". This can be found on any UNIX platform, and there
> are implementations for other platforms (e.g. MKS toolkit for DOS/Windows).
>
> When I did the server upgrade, I exported all data using the "dbexport"
> utility and then ran a script that invoked sed for all of the generated
> ".unl" files:
>
> for i in *.unl
> do
> sed -f umlaut.sed $i > $i.1
> mv $i $i.2
> mv $i.1 $i
> done
>
> I assume you have 7-bit German characters, so here is the sed script
> "umlaut.sed" to convert these:
>
> s/|/\\ö/g
> s/\\\\\\\\/\\Ö/g
> s/{/\\ä/g
> s/\\[/\\Ä/g
> s/}/\\ü/g
> s/]/\\Ü/g
> s/~/\\ß/g
>
> Hope this helps,
> Richard
> --
> +--------------------------+------------------------------------------+
> | Dr. Richard Spitz | INTERNET: spitz@ana.med.uni-muenchen.de |
> | EDV-Gruppe Anaesthesie | Tel : +49-89-7095-6110 <-- NEW! |
> | Klinikum Grosshadern | FAX : +49-89-7095-8886 |
> | 81366 Munich, Germany | GSM : +49-172-8933578 |
> +--------------------------+------------------------------------------+
The Unix tr command will work more efficiently than sed and is easier to
understand.
--
Peter Lancashire
Information Systems Specialist, Bayer plc
Eastern Way, Bury St Edmunds, Suffolk, IP32 7AH, UK
Tel: +44-1635-562258, Fax: +44-1635-562281
--
If all else fails, read the instructions and the release notes.
Join Infuse, the UK Informix User Group at http://www.infuse.org.uk/