Character Convertion Help Needed


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Character Convertion Help Needed
# 1  
Old 02-28-2008
Question Character Convertion Help Needed

Could someone please tell me how to convert double byte charaters to single byte characters in HP-UX 11.11 without installing any applications?
e.g. I have a double byte string below and I want to convert it to a single byte string ABCdef123

ABCdef123

I tried using the iconv command but I just get a message "iconv: can not initialize the conversion".
Code:
iconv -f eucJP -t engle < note.txt > note2.txt

# 2  
Old 02-28-2008
Quote:
Originally Posted by stevefox
Could someone please tell me how to convert double byte charaters to single byte characters in HP-UX 11.11 without installing any applications?
e.g. I have a double byte string below and I want to convert it to a single byte string ABCdef123

ABCdef123

I tried using the iconv command but I just get a message "iconv: can not initialize the conversion".
Code:
iconv -f eucJP -t engle < note.txt > note2.txt



Which encoding is engle ?

Code:
[/tmp]$ iconv -l | grep -i eucjp
EUCJP-MS//
EUCJP-OPEN//
EUCJP-WIN//
EUCJP//
[/tmp]$ iconv -l | grep -i engle
[/tmp]$

Perhaps that may be the missing link.
# 3  
Old 02-28-2008
Hi Vino,

Thanks for your quick response.

I was just looking for a normal single byte english encoding and I found "engle" in /usr/lib/nls/iconv/config.iconv as the only one with the word "English" in the description so I tried that.

Could you tell me the correct encoding for normal single byte english?

BTW on my HP-UX 11.11 the "-l" option for iconv does not work.

Cheers
Steve

Last edited by stevefox; 02-28-2008 at 04:17 AM..
# 4  
Old 03-03-2008
ISO8859-1 is typically regarded as the "English" encoding by most people.

However ....

My understanding is that the full-width version of the characters are of different characters from their half-width counterparts, so they are considered different and I am not inclined to believe that you can use iconv to convert between them, without looking up an external mapping table.

For example, with Chinese that I use, input method editors (some OS, e.g. Windows, IME is part of the OS) typically carry this table as part of the install, but I am not sure if you can find a version that allows you to extract this table and use that directly. Of course, as you said, some applications exist which knows how to convert but you mentioned you do not wish to use them. My feeling is that if you know both the half-width and full-width code assignments, you can hack this table yourself.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed searches a character string for a specified delimiter character, and returns a leading or traili

Hi, Anyone can help using SED searches a character string for a specified delimiter character, and returns a leading or trailing space/blank. Text file : "1"|"ExternalClassDEA519CF5"|"Art1" "2"|"ExternalClass563EA516C"|"Art3" "3"|"ExternalClass305ED16B8"|"Art9" ... ... ... (2 Replies)
Discussion started by: fspalero
2 Replies

2. Shell Programming and Scripting

Perl script database date convertion

Need assistance Below script get the output correctly I want to convert the date format .Below is the output . Any idea ? #!/usr/bin/perl -w use DBI; # Get a database handle by connecting to the database my $db = DBI->connect(... (3 Replies)
Discussion started by: ajayram_arya
3 Replies

3. Shell Programming and Scripting

Convertion from Exponential to Decimal

I am trying to read values from excel and perform some calculations but I am getting below error: expr 2.326227180240883E7 / 8.509366417956961E8 expr: non-numeric argument Can anyone let me know how do i convert thse exponential numbers to decimal. (2 Replies)
Discussion started by: sachinnayyar
2 Replies

4. Shell Programming and Scripting

Convertion of Date Format using SQL query in a shell script

When I write Select date_field from TableA fetch first row only I am getting the output as 09/25/2009. I want to get the output in the below format 2009-09-25 i.e., MM-DD-YYYY. Please help (7 Replies)
Discussion started by: dinesh1985
7 Replies

5. Shell Programming and Scripting

read in a file character by character - replace any unknown ASCII characters with spa

Can someone help me to write a script / command to read in a file, character by character, replace any unknown ASCII characters with space. then write out the file to a new filename/ Thanks! (1 Reply)
Discussion started by: raghav525
1 Replies

6. Shell Programming and Scripting

convertion of a file

Hi I am having file like this 1 560017039 575052020 22-11-2003 8,290.00 709545 100239050 11 2 560017006 575052020 13-01-2008 20,000.00 709545 100246770 11 i want to convert it like 5600170395750520202211200300000008290000000000000709545010023905011... (8 Replies)
Discussion started by: suryanarayana
8 Replies

7. Shell Programming and Scripting

Hex to Decimal Convertion

Dear all, I have a file like this. EE48 4473 7FC9 EE48 102C D23 EE48 4DD 27D EE48 0 0 EE48 3FFE 854 F230 DC6 ... (1 Reply)
Discussion started by: Nayanajith
1 Replies

8. Shell Programming and Scripting

Help needed in character replacement in Korn Shell

How do I replace a space " " character at a particular position in a line? e.g. I have a file below $ cat i2 111 002 A a 33 0011 B c 2222 003 C a I want all the 1st spaces to be replaced with forward slash "/" and the 3rd spaces to have 5 spaces to get the output below: 111/002... (8 Replies)
Discussion started by: stevefox
8 Replies

9. Filesystems, Disks and Memory

convertion

How to convert a .doc document to .pdf (2 Replies)
Discussion started by: areef4u
2 Replies

10. Shell Programming and Scripting

ASCII to char convertion

I am writing the script to encrypt and decrypt content of the text file. How can I convert ASCII to characters and backward? I need it for Bourne shell script. Thanks::confused: (3 Replies)
Discussion started by: woody
3 Replies
Login or Register to Ask a Question