My application running in Linux connects to informix database and fetches data from a TEXT column. The column content has some extended characters. For ex: XXX³X and AAA’A. The two characters ³ and ’ have value 179 and 146 which i found by printing in the code as well as from the website.
Please refer to the below line for the number and characters against them. http://www.tony-franks.co.uk/UTF-8.htm
LANG and LC_CTYPE env variables for my terminal session are set as follows.
LANG=en_US.UTF-8 and LC_CTYPE=en_US.UTF-8
My issue is:
When i print 146 using %c , instead of getting the expected ’ character i get only null character but character for 179 is printed properly and when i send both characters to file and do a cat of that file, the character for 179 is displayed properly. But when i do a vi of that file name, it is showing some junk.
Here is the program.
unsigned char x=179;
unsigned char y=146;
printf("%c %d \n", x,x);
printf("%c %d \n", y,y);
³ 179 ---> this is correct
146 ---> Unfortunately this is null character (not even a space)
Cat displays properly
But vi myfile.txt shows, Â³<92>
Can you let me know what is the issue? why vi is not showing properly. I am not able migrate this data into a table in oracle also.
should i use iconv? If so how to use it.
when i say file myfile.txt
myfile.txt: Non-ISO extended-ASCII text, with no line terminators