This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
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.
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
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:
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.
Mods, forgive me if I have posted in wrong place.
Thanks in advance.
bash: ££: command not found
. . . even though it can't find anything to do with it. Now CMD.exe, that's something different. It prints ú instead!
Joined: Sep 16, 2008
well i have tried
in order to explicitly change the encoding, but this is also not working on solaris and printing same "?" instead of
Can you suggest me how to encode programmatically in java instead of specifying option -Dfile.encoding=ISO-8859-1 from unix.
Joined: Sep 16, 2008
Is Pane a good idea to implement in this case? I took strategy where each line of the file read sequentially and print it using System.out.println() there by applying the encoding explicitly as suggested,
Set the encoding with a particular value. It worked.
Thanks to all of you spending time and reading this post.