i have to write a little parsing application, which is rewriting a postscriptfile with some additional infos.
To reach that goal, i am just using a BufferedReader with a FileReader and a FileWriter. But i am reaching into a problem with an escape character (the % sign).
Java is ignoring this character, the line "%!PS-Adobe-3.0" from the input file will be "!PS-Adobe-3.0" in the String and further the same in the output file.
Do you fellaz have any ideas, how i can do that ... except from reading bytewise :D
Best regards
edit: Here is the code fragment ... the base file is in encoded in UTF8 :
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(args[0]), "UTF-8")); String line = br.readLine();
Before i testet it with the following: BufferedReader br = new BufferedReader(new FileReader(args[0]));
It fails at the same problem -> "%!PS-Adobe-3.0" from the input file became "!PS-Adobe-3.0" in the variable "line"
%is not special to any of the classes you've listed.%correctly. Either the character isn't there and you just think it is (perhaps whatever you're using to look at it uses%to indicate something?), or you're doing something else, elsewhere, that strips it out or treats it specially.