dbaspot
Tags Register FAQ Calendar Search Today's Posts Mark Forums Read

handling special characters in AIX with C - aix

This is a discussion on handling special characters in AIX with C - aix ; Hi, I have this host which sends a text file in UTF-8 via ftp. But when my program reads the file in AIX, it is not able to handle the German umlaut character Ä which is in the file. My ...


Home > Database Forum > Operating Systems > aix > handling special characters in AIX with C

Reply

 

LinkBack Thread Tools Display Modes
  #1  
Old 11-09-2008, 07:37 AM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default handling special characters in AIX with C

Hi,

I have this host which sends a text file in UTF-8 via ftp. But when my
program reads the file in AIX, it is not able to handle the German
umlaut character Ä which is in the file.
My program is in C. I am using AIX 4. The program opens the text file
and reads each character using fscanf(fp,"%c",&inChar) where fp is the
file pointer and inChar is the variable into which each character is
stored.

Any Idea how I can rectify this?
Reply With Quote
  #2  
Old 11-09-2008, 03:39 PM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: handling special characters in AIX with C

avikrc18@gmail.com wrote:
> Hi,
>
> I have this host which sends a text file in UTF-8 via ftp. But when my
> program reads the file in AIX, it is not able to handle the German
> umlaut character Ä which is in the file.
> My program is in C. I am using AIX 4. The program opens the text file
> and reads each character using fscanf(fp,"%c",&inChar) where fp is the
> file pointer and inChar is the variable into which each character is
> stored.
>
> Any Idea how I can rectify this?



3 obvious solutions:
- make people send a data file which your program can handle
- get gnu recode and convert the data file before running your program
- rewrite your program to handle "multibyte character sets". not sure if
there is an adequate compiler and libraries for the outdated aix 4, though.

regards
Joachim Gann
Reply With Quote
  #3  
Old 11-09-2008, 04:54 PM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: handling special characters in AIX with C

avikrc18@gmail.com wrote:

> Hi,
>
> I have this host which sends a text file in UTF-8 via ftp. But when my
> program reads the file in AIX, it is not able to handle the German
> umlaut character Ä which is in the file.
> My program is in C. I am using AIX 4. The program opens the text file
> and reads each character using fscanf(fp,"%c",&inChar) where fp is the
> file pointer and inChar is the variable into which each character is
> stored.
>
> Any Idea how I can rectify this?


Perhaps after receiving the file you can run it through "tr" and translate
the identified character(s) into another character that you can process
correctly. Use command man tr for details and outputfile when
you run it.

Good luck.

Reply With Quote
  #4  
Old 11-11-2008, 05:06 AM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: handling special characters in AIX with C

On Nov 10, 1:54*am, Bob M wrote:
> avikr...@gmail.com wrote:
> > Hi,

>
> > I have this host which sends a text file in UTF-8 via ftp. But when my
> > program reads the file in AIX, it is not able to handle the German
> > umlaut character Ä which is in the file.
> > My program is in C. I am using AIX 4. The program opens the text file
> > and reads each character using fscanf(fp,"%c",&inChar) where fp is the
> > file pointer and inChar is the variable into which each character is
> > stored.

>
> > Any Idea how I can rectify this?

>
> Perhaps after receiving the file you can run it through "tr" and translate
> the identified character(s) into another character that you can process
> correctly. *Use command man tr for details and outputfile when
> you run it.
>
> Good luck.


Perhaps you can try using the wide-character or multi-byte input
routines.

Thanks and regards,
Rajbir Bhattacharjee
Reply With Quote
  #5  
Old 11-11-2008, 06:49 AM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: handling special characters in AIX with C

Maybe the iconv routines will help... man -k iconv...

-Mike
Reply With Quote
  #6  
Old 02-23-2010, 03:32 AM
Database Expert
 
Join Date: Feb 2010
Posts: 42
HENARRY JAYA is on a distinguished road
Default Re: handling special characters in AIX with C

A simpler method might just be to store the data in a session instead of rewriting it to the form in hidden fields. See below for PHP Sessions:

If you absolutely need to put the data in hidden fields, you could try replacing new lines/carriage returns with a specific character (or characters), and then convert it back when you need to.

Example, you could replace \n with "[br]", write it to the hidden form field, and then when you get it back, replace [br] with \n.
Reply With Quote
Reply

Thread Tools
Display Modes



All times are GMT -4. The time now is 02:48 AM.