unable to extract Trademark() Character

Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users unable to extract Trademark() Character
# 1  
Old 08-31-2008
unable to extract Trademark() Character

Hello All,

I am trying to extract a trademark character () from a varchar column in a DB2 Table. The result is to be placed in a sequential file in an AIX environment.

After the Extraction is complete when I view the extracted file I noticed that in place of the () Character another highlighted character SUB has been placed.

It would be great if anyone can shed some light as to why it does not display the () Character. Could it be because the AIX character set does not allow this special character ?

Would appreciate your Advice. Thank You
# 2  
Old 08-31-2008
Originally Posted by cosec
Could it be because the AIX character set does not allow this special character ?
Yes. However if you were to load the output file in a similar environment to the one where you were viewing the data originally you should still see the TM character, as at a binary level it should be unchanged.
# 3  
Old 09-01-2008
There is no such thing as an "AIX character set". There are bytes in the file, and there is your terminal, and there are multiple conventions for how to display the bytes in the file on any particular terminal. If you know the character set encoding of the file, and the character repertoire of your terminal, you can predict how any particular byte sequence will be displayed, but if one or the other is unknown, it's pretty hard to say what you should expect (or even indeed what you are talking about).

Plain 7-bit data is usually displayed as ASCII, which is completely well-defined, but the (tm) character is not part of the 7-bit ASCII character set; you are apparently viewing the file under two different interpretations of the character-set encoding in the file, perhaps using two different terminals, or different tools which impose different assumptions. (On AIX perhaps you have the option to add EBCDIC into the mix, but let's not go there.)

Anyway, to troubleshoot this, you might want to use a hex dump tool (od, xxd, hexdump, or even just cat -A) to inspect what the actual bytes in the file are. Once you know that, it should not be hard to figure out which encoding gives the interpretation you want, and/or convert the file to the representation you want.
# 4  
Old 09-01-2008
Thanks For the response..I found out that the encoding character set used is ISO8859-1 and does not have the Trademark sign. The Trademark character is a reserved word and there displayed as SUB.

Is it possible to convert the file to another with file with a different encoding character set and be able to display the Trademark character ?

If so, how could it be done via unix ?

# 5  
Old 09-01-2008
Where do you need to display the Trademark character? In an AIX terminal session of some kind? Or in some application or client that connects to the server? Or on some other system that the data will eventually be transferred to?
# 6  
Old 09-02-2008
The big question is in which character set you do see the trademark sign, or, which ISO-8859-1 character are you seeing as a SUB character (whatever that is?)

In ASCII there is a control character SUB (ctrl-Z) which has the character code 26 decimal (octal 032, hex 0x1A) -- is that what you have in your file? What would be a useful encoding to transfer it to? The following will translate all occurrences of this character code into the Unicode trade mark symbol character U+2122 in the UTF-8 encoding:

perl -pe 's/\x1A/\xE2\x84\xA2/g' file.orig > file.utf8

Or in ISO-8859-1, there is the Registered sign at code point 0xAE, would that be a useful substitute?

perl -pe 's/\x1A/\xAE/g' file.orig > file.iso-8859-1

This assumes that the SUB character really is character code 0x1A; if it's not, but you can find out what it is instead, it should be trivial to adapt either of these one-liners to something which works for you. Some Windows code pages have the trademark symbol at 0x99 so that might be a thing to try if 0x1A doesn't work for you (but again, if you can look at the raw bytes in the file, you don't have to guess).

Last edited by era; 09-02-2008 at 02:59 AM.. Reason: Add ISO8859-1 substitution; remark on Windows 0x99 character
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Unable to create new user without lower character

Hi friends, I want to create new user BG0001 in SunOS and getting below errorbash-3.2# useradd -d /home/BG0001 -m -s /bin/sh BG0001 UX: useradd: BG0001 name should have at least one lower case character. bash-3.2# bash-3.2# OS version is as belowbash-3.2# cat /etc/release ... (7 Replies)
Discussion started by: sandeepkmehra
7 Replies

2. Red Hat

Unable to extract .gz file using gunzip

Linux 3.8.13-16.2.1.el6uek.x86_64 #1 SMP Thu Nov 7 17:01:44 PST 2013 x86_64 x86_64 x86_64 GNU/Linux Hi all, I am unable to extract .gz file using gunzip Used the following command to create the .gz file: nohup tar -cvpf - | gzip -c >... (3 Replies)
Discussion started by: a1_win
3 Replies

3. Programming

Unable to assign zero to unsigned character array

Hi, I am unable to assign value zero to my variable which is defined as unsigned char. typedef struct ABCD { unsigned char abc; unsigned char def; unsigned char ghi; } ABCD; typedef ABCD *PABCD; In my Por*C code, i assign the values using memcpy like below ... (3 Replies)
Discussion started by: gthangav
3 Replies

4. UNIX for Dummies Questions & Answers

Unable to extract bz2-00 file

I have a file having name smthing.tar.bz2-00 I am trying to unzip it using tar -xvjf "name" But I am not able to unzip it. PLease advise for the issue. (3 Replies)
Discussion started by: nixhead
3 Replies

5. Shell Programming and Scripting

Unable to read special character from the file

Hello All, We are getting files from sftp server through file transmission protocol & after transmission we are removing all the control M (^M) characters from them.we are expecting various kind of special characters in the files. we are tried removing '^M' characters through 'dos2unix' command... (2 Replies)
Discussion started by: Aquilis
2 Replies

6. Shell Programming and Scripting

extract character + 1

Hi, I would like extract from a file a character or pattern after ( n + 1) a specific pattern (n) . ( i supposed with awk) how could i do ? Thanks in advance. (1 Reply)
Discussion started by: francis_tom
1 Replies

7. UNIX for Advanced & Expert Users

Extract a character

HI Guys, Have a Doubt...... I have a pattern "abcdef" and i need to extract the third character..ie(c) How to achieve it? (10 Replies)
Discussion started by: aajan
10 Replies
Login or Register to Ask a Question

Featured Tech Videos