Re: EBCDIC conversion

From: David W Noon <david(dot)w(dot)noon(at)googlemail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Cc: mike(dot)blackwell(at)rrd(dot)com
Subject: Re: EBCDIC conversion
Date: 2014-03-29 00:15:28
Message-ID: 533610A0.5010709@googlemail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 28/03/14 00:31, David W Noon wrote:
> I think the real issue is that you need icu or libiconv installed.
> You will also need to know which EBCDIC code page you want: U.S.
> EBCDIC is cp37, IIRC.
>
> I suspect you will need to write a C or Python function that
> performs a test conversion, using icu or libiconv, and return a
> Boolean result. It should not be too difficult if you can write C
> or Python.

Since I had a few minutes tonight, I created a quick hack in Python.
It should be attached to this message, unless the list server removes it.

Here is a sample usage in psql:

dwn=# \i ./check_code_page.sql
CREATE FUNCTION
dwn=# select check_code_page('abcxyz', 'cp037');
check_code_page
- -----------------
t
(1 row)

dwn=# select check_code_page('abcä', 'cp037');
check_code_page
- -----------------
f
(1 row)

You'll note that the a-umlaut character fails in the conversion to
cp037 (U.S. EBCDIC).
- --
Regards,

Dave [RLU #314465]
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
david(dot)w(dot)noon(at)googlemail(dot)com (David W Noon)
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlM2EKAACgkQogYgcI4W/5QgYACcDRjE4Ov9GomHX/6RWP+vJnsG
7Y8AoK3K7IbHVLmAmBV8prdvNy9sJ3Pm
=04Rb
-----END PGP SIGNATURE-----

Attachment Content-Type Size
check_code_page.sql application/sql 436 bytes

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Willy-Bas Loos 2014-03-29 15:19:02 Re: [GENERAL] openvz and shared memory trouble
Previous Message Jeff Janes 2014-03-28 20:02:02 Re: PG choosing nested loop for set membership?