Wednesday, September 28, 2011

Oracle Report Output giving junk characters

Hi All.


Here is the new issue that I found during migration from AIX servers to Red Hat 5.6.
I upgraded the 11.5.9 to 12.1.3 and during the customer check we found that all custom oracle  reports (1200) giving the junk characters on free text area. The data comes OK.
I asked the developer to check it. When he opened the rdf file with Oracle Reporter and rewrited the free text, the output become good.


I checked in google and found that the CHARSET may be different between AIX and Red HatCHARSET in AIX was 31 and in Redhat 38. 


How to find the right CHARSET:
1. In Oracle Reports check the new created free text.
2. Create a new report with free text and convert it to REX file. Look for CHARSET and see what you CHARSET need to be.


So I need to change all reports manually to the right CHARSET.
Here the Linux script that I created to change the CHARSET in all (1200) custom reports.


for f in *.rdf
do
RDF_FILE=$f
RDF_FILE=`echo $RDF_FILE | awk -F"." '{ print $1 }'`

chmod 777 $RDF_FILE.rdf
#Convert rdf file to rex 
rwconverter userid=apps/apps source=$RDF_FILE.rdf dest=$RDF_FILE.rex stype=rdffile dtype=rexfile overwrite=yes batch=yes
#Remove junk characters
cat $RDF_FILE.rex | tr -d "\015" > $RDF_FILE.rextmp
#Change Charset to 38
sed -e 's/CHARSET = 0/CHARSET = 38/' -e 's/CHARSET = 31/CHARSET = 38/' -e 's/CHARSET = 178/CHARSET = 38/' -e 's/CHARSET = 871/CHARSET = 38/' < $RDF_FILE.rextmp> $RDF_FILE.rex
#Convert rex file to rdf
rwconverter userid=apps/apps source=$RDF_FILE.rex dest=$RDF_FILE.rdf stype=rexfile dtype=rdffile  overwrite=yes batch=yes
rm -f $RDF_FILE.rex
chmod 777 $RDF_FILE.rdf
done;


Hope it will help you.


Good Luck ...



1 comment:

  1. BlueHost is definitely the best web-hosting provider for any hosting services you might need.

    ReplyDelete