conversion required


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting conversion required
# 1  
Old 02-19-2010
Java conversion required

A characters array looks like this.
arr[]={'À','à','Â','Æ'}
i want to convert these charcters into utf8 and save in the text file
when retreiving back, i want to convert back to the original format.
can u give ideas to write this snippet in either c or shell
# 2  
Old 02-19-2010
Hope fully this function will work
Code:
unsigned char* AsciiToUnicode (unsigned char ch)
{ 
        unsigned char val[2];
        if ((ch < 192)&&(ch != 168)&&(ch != 184))  {
                val[0] = 0; 
                val[1] = ch;
                return val;
        }
        if (ch == 168) {
         val[0] = 208;   Val[1] = 129;   return val;
       }
        if (ch == 184) {
            val[0] = 209;  
            Val[1] = 145;   
           return val;
                  }
        if (ch < 240)  {
                val[0] = 208;
                val[1] = ch-48; 
                return val;
             }
        if (ch < 249)  {
                val[0] = 209; 
                val[1] = ch-112;
                 return val;
              }
}

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help required for Oracle database shutdown script conversion from shell to perl

Please tell me how to convert below program from shell script to perl. Same commands need to use in shutdown, just need program help for startup. export ORACLE_BASE=/home/oracle1 lsnrctl start lndb1 sqlplus '/ as sysdba' startup; (2 Replies)
Discussion started by: learnbash
2 Replies

2. UNIX for Advanced & Expert Users

.so to .sl conversion ?

Hi all, I have one libxxx.so file ( which I got from a third party ). We use shared library libxxx.sl . Is there any way to convert the .so file to .sl file ? Thanks in advance - M (3 Replies)
Discussion started by: kanu_kanu
3 Replies

3. Programming

pointer conversion in c

hi there fellos could someone teach me how to convert a character pointer into an integer using c much love (1 Reply)
Discussion started by: surubi_abada
1 Replies

4. Shell Programming and Scripting

Help in conversion ......

Hi, I have a requirement to capture file time stamp and compare with current system time. I am using HP-AUX K-shell. Below is what i have done Getting current date into myfile2 --------------------------------- date +%Y%m%d%H%M%S > myfile2 20091110132800 Getting the file date into... (5 Replies)
Discussion started by: chinniforu2003
5 Replies

5. Shell Programming and Scripting

Conversion

How to convert Nov 10 14:20 to YYYYMMDDHHMMSS in unix I am using K-shell HP-AUX (1 Reply)
Discussion started by: chinniforu2003
1 Replies

6. Shell Programming and Scripting

Getting required fields from a test file in required fromat in unix

My data is something like shown below. date1 date2 aaa bbbb ccccc date3 date4 dddd eeeeeee ffffffffff ggggg hh I want the output like this date1date2 aaa eeeeee I serached in the forum but didn't find the exact matching solution. Please help. (7 Replies)
Discussion started by: rdhanek
7 Replies

7. Shell Programming and Scripting

conversion

hi all i have a file like 151125 25252 2452567 253464576 255 i want this file to be like '151125','25252','2452567','253464576','255' please help thanks (3 Replies)
Discussion started by: infyanurag
3 Replies

8. Shell Programming and Scripting

date conversion

Hi everybody: Could anybody tell me how I convert from a julian date, with shell comands, to gregorian. Thanks in advance. (2 Replies)
Discussion started by: tonet
2 Replies

9. UNIX for Advanced & Expert Users

conversion

Dear friends, i am writing sh shell script I have a file containing binary data. like this. 010101010101010101101010101010100001010101010101001. i want to read some particular bits and convert it into decimal valuse. example. 1.first i want to read 5 bits and convert it into... (1 Reply)
Discussion started by: rajan_ka1
1 Replies

10. UNIX for Dummies Questions & Answers

Conversion Problem

hi, i am reading a string values from a file.the values are 2000 20000 300 10 5000 now retrieving each value one by one and printing if they are greater than 1000. i use this statement for the same (in perl script) if ($_ gt 1000){ print $_ } but its now prininting all... (3 Replies)
Discussion started by: vivekshankar
3 Replies
Login or Register to Ask a Question