How to make a £ symbol printed from a file?

Hi,

I am working on Solaris and facing a problem. I have a .DAT file which simply contains some data in particular format which includes � symbol. The fomat looks like

001|�30VB | | |T+T250|�30 Value Bundle |1|1|1 |0 |0|0 | |0|1010906 |93731 |TREVORJ |CRBCE1P |1090713 |134739 |JAMESMAT |CRBCE1P |9 |1|PRE-REPORT | | |

The requirement is a java program will be reading the file and printing the same file as it is. But when my program is reading the file and printing everthing is perfectly printed except "�" symbol (read as pound). It is printing "?" instead.

Observations :

  1. When I am doing "cat Myfile.DAT" every thing getting displayed perfectly including � symbol.
  2. When I am opening the same file in vi editor it is displaying ASCII value for � symbol. (/243).
  3. I tried to change the encoding from java level by setting the property (in the program Myprog.java) like this
javac Myfile.java
    java -Dfile.encoding="ISO-8859-1" Myfile
It is reading the .DAT file properly and printing properly. But the bottleneck is , we can not execute the java program from command line as a matter of fact, I tried to set the property\(file.encoding\) in code level by writing this:
System.getproperty("file.encoding" , "ISO-8859-1"); 
but this does not work. From java level I am checking, it is showing that property has been set but actually the program is not working if I do it from code level.

How to proceed? Any ideas? Hopefully this has to be handled in java level not in Unix level \(not sure\).
Just to read a dat file and print the file output using java. 
Thanks in advance.

Regards,
Bhaskar

Are you sure the file format is in ISO-8859-1?
maybe you shell enviorement is in ISO-8859-1 but this no means you file is in this code charset.
Be sure in which characterset are writing your file....for this porpues you can use some application/command that asegure you that the file is writing in this charset, the comand "file" can give you the charset or for example if you work with eclipse you can changed the encoding when you go to save the file
Other way is to probe change the -Dfile.encoding parameter...
I'll probe with
-Dfile.encoding=UTF16
-Dfile.encoding=UTF8

hope this can help you in something...

Hi,

Many thanks I am approaching with the same process.

Regards,
Bhaskar