New to informix Help needed with ASCII
Posted in 2010
A newcomer asked how to display the hex/ASCII codes of a CHAR/VARCHAR column (like SQL Server's ASCII() or Oracle's DUMP()), because dbaccess wasn't showing Spanish accented characters correctly. Suggestions: check/set the LOCALE (DB_LOCALE, CLIENT_LOCALE) environment variables since that's the likely cause of the display problem; use Informix's ASCII() function on one character at a time (e.g. ASCII(col[1,1])); dump pages with oncheck -pp using the row's rowid; or UNLOAD to a file and inspect it with hexdump/od. Jonathan Leffler noted there's no simple built-in per-character code function (IIUG archive tools exist for single-byte code sets, not multibyte) and asked which code set/locales were used. No confirmed resolution from the poster is recorded.
Auto-generated by DrWatson from the posts below — may be imperfect; read the full thread.
Topics: Server Administration, Data Types & Schema Design
Hello,
I am new to Informix, I wonder if there is some
command to show the ascii hex codes of a char / varchar column.
Something similiar to sqlserver ASCII(col1) or oracle dump(col1)
I mean I want to be sure I have inserted the correct letters, but
dbaccess could not show them properly.
The problem letters are those pertaining to Spanish alphabet such as
ñáéóú
Thanks in advance
Regards,
Andres
Maybe you need to set your LOCALE env variable for Spanish?
Bob
----- Original Message -----
From: "DOCTOR DOOM" <margilca@gmail.com>
To: ids@iiug.org
Sent: Wednesday, April 28, 2010 2:08:00 PM GMT -05:00 US/Canada Eastern
Subject: New to informix Help needed with ASCII [19918]
Hello,
I am new to Informix, I wonder if there is some
command to show the ascii hex codes of a char / varchar column.
Something similiar to sqlserver ASCII(col1) or oracle dump(col1)
I mean I want to be sure I have inserted the correct letters, but
dbaccess could not show them properly.
The problem letters are those pertaining to Spanish alphabet such as
Thanks in advance
Regards,
Andres
*******************************************************************************
Forum Note: Use "Reply" to post a response in the discussion forum.
Yes, it may be due to incorrect locale settings. Out of curiosity is there any function or procedure to display hex codes of a string ? Thanks Cheers Andres
Hi Andres,
You can use the dump pages directly from disk with oncheck
1. select tabname, rowid from systables *for find rowid... (replace
your database and your table).*
2. oncheck -pp sysadmin:systables 1282 is rowid from select.
Petr
DOCTOR DOOM wrote:
> Hello,
> I am new to Informix, I wonder if there is some
> command to show the ascii hex codes of a char / varchar column.
> Something similiar to sqlserver ASCII(col1) or oracle dump(col1)
>
> I mean I want to be sure I have inserted the correct letters, but
> dbaccess could not show them properly.
> The problem letters are those pertaining to Spanish alphabet such as
> ñáéóú
>
> Thanks in advance
>
> Regards,
> Andres
>
>
>
*******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
>
There is an ASCII() function and it works just fine, but you can only pass
it a single character at a time:
select ASCII(mycolumn[1,1] from mytable where ....;
Art
Art S. Kagel
Advanced DataTools (www.advancedatatools.com)
IIUG Board of Directors (art@iiug.org)
See you at the 2010 IIUG Informix Conference
April 25-28, 2010
Overland Park (Kansas City), KS
www.iiug.org/conf
Disclaimer: Please keep in mind that my own opinions are my own opinions and
do not reflect on my employer, Advanced DataTools, the IIUG, nor any other
organization with which I am associated either explicitly, implicitly, or by
inference. Neither do those opinions reflect those of other individuals
affiliated with any entity with which I am affiliated nor those of the
entities themselves.
On Wed, Apr 28, 2010 at 2:08 PM, DOCTOR DOOM <margilca@gmail.com> wrote:
> Hello,
> I am new to Informix, I wonder if there is some
> command to show the ascii hex codes of a char / varchar column.
> Something similiar to sqlserver ASCII(col1) or oracle dump(col1)
>
> I mean I want to be sure I have inserted the correct letters, but
> dbaccess could not show them properly.
> The problem letters are those pertaining to Spanish alphabet such as
>
>
> Thanks in advance
>
> Regards,
> Andres
>
>
>
>
*******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
>
--001636e0b6b3d0acb3048563835c
If you have the regex blade installed you code do a regex_replace()
-----Original Message-----
From: ids-bounces@iiug.org [mailto:ids-bounces@iiug.org] On Behalf Of Art
Kagel
Sent: Thursday, April 29, 2010 12:33 PM
To: ids@iiug.org
Subject: Re: New to informix Help needed with ASCII [19936]
There is an ASCII() function and it works just fine, but you can only pass
it a single character at a time:
select ASCII(mycolumn[1,1] from mytable where ....;
Art
Art S. Kagel
Advanced DataTools (www.advancedatatools.com)
IIUG Board of Directors (art@iiug.org)
See you at the 2010 IIUG Informix Conference
April 25-28, 2010
Overland Park (Kansas City), KS
www.iiug.org/conf
Disclaimer: Please keep in mind that my own opinions are my own opinions and
do not reflect on my employer, Advanced DataTools, the IIUG, nor any other
organization with which I am associated either explicitly, implicitly, or by
inference. Neither do those opinions reflect those of other individuals
affiliated with any entity with which I am affiliated nor those of the
entities themselves.
On Wed, Apr 28, 2010 at 2:08 PM, DOCTOR DOOM <margilca@gmail.com> wrote:
> Hello,
> I am new to Informix, I wonder if there is some
> command to show the ascii hex codes of a char / varchar column.
> Something similiar to sqlserver ASCII(col1) or oracle dump(col1)
>
> I mean I want to be sure I have inserted the correct letters, but
> dbaccess could not show them properly.
> The problem letters are those pertaining to Spanish alphabet such as
>
>
> Thanks in advance
>
> Regards,
> Andres
>
>
>
>
****************************************************************************
***
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
>
--001636e0b6b3d0acb3048563835c
****************************************************************************
***
Forum Note: Use "Reply" to post a response in the discussion forum.
_____
avast! Antivirus <http://www.avast.com> : Outbound message clean.
Virus Database (VPS): 100429-0, 04/29/2010
Tested on: 4/29/2010 12:41:41 PM
avast! - copyright (c) 1988-2010 ALWIL Software.
Hi Andres,
One other option is to unload the data to a file and check the hex codes
with OS utilities like hexdump or od.
For example, from dbaccess:
unload to spanish.unl select * from mytabname;
and from the OS shell:
hexdump -C spanish.unl
In most cases, hexdump and od are available on Linux systems. And od is
available on Unix systems.
Regards,
Sumanth.
On Wed, Apr 28, 2010 at 11:08 AM, DOCTOR DOOM <margilca@gmail.com> wrote:
> Hello,
> I am new to Informix, I wonder if there is some
> command to show the ascii hex codes of a char / varchar column.
> Something similiar to sqlserver ASCII(col1) or oracle dump(col1)
>
> I mean I want to be sure I have inserted the correct letters, but
> dbaccess could not show them properly.
> The problem letters are those pertaining to Spanish alphabet such as
>
>
> Thanks in advance
>
> Regards,
> Andres
>
>
>
>
*******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
>
--00504501572d17008904856d966e
On Wed, Apr 28, 2010 at 11:08, DOCTOR DOOM <margilca@gmail.com> wrote:
> I am new to Informix, I wonder if there is some
> command to show the ascii hex codes of a char / varchar column.
> Something similiar to sqlserver ASCII(col1) or oracle dump(col1)
>
> I mean I want to be sure I have inserted the correct letters, but
> dbaccess could not show them properly.
> The problem letters are those pertaining to Spanish alphabet such as
>
>
When I cut and paste those four characters on a Mac, I see bytes in hex as:
D7 A1 D7 91 D7 99 D7 A3 D7 AA
If I interpret them as Unicode UTF-16 characters in big-endian format, then
these are from the Hangul Syllables: U+D7A1, U+D791, U+D799, U+D7A3, U+D7AA
(where the last is not a valid code point in the current Unicode 5.x
version).. If they are in little-endian format, then they are from a very
diverse set of scripts.
If those are UTF-8, then:
0xD7 0xA1 = U+05E1 = HEBREW LETTER SAMEKH
0xD7 0x91 = U+05D1 = HEBREW LETTER BET
0xD7 0x99 = U+05D9 = HEBREW LETTER YOD
0xD7 0xA3 = U+05E3 = HEBREW LETTER FINAL PE
0xD7 0xAA = U+05EA = HEBREW LETTER TAV
None of these looks systematically like Spanish characters.
What code set did you think you were using?
What CLIENT_LOCALE and DB_LOCALE did you have set in the environment:
1. When you created the database?
2. When you tried to insert or select the data?
To answer the direct question, there isn't a simple way to get the character
code corresponding to a character. For a single-byte code set, there are
tools in the IIUG Software Archive that will do the job; for multi-byte code
sets, I don't think there is a tool available.
...unless someone has said differently already...
--
Jonathan Leffler #include <disclaimer.h>
Email: jleffler@earthlink.net, jleffler@us.ibm.com
Guardian of DBD::Informix v2008.0513 -- http://dbi.perl.org/
"Blessed are we who can laugh at ourselves, for we shall never cease to be
amused."
NB: Please do not use this email for correspondence.
I don't necessarily read it every week, even.
--001485eaffd8e714a70485a816fb