[encoding]Stupid question regarding encoding  
Author Message
Daniel Moyne





PostPosted: 2007-2-19 17:55:00 Top

java-programmer, [encoding]Stupid question regarding encoding I have written a java plugin for an application that reads a file to execute
a series of actions ; when I parse my text file I check for the existence
of the following line "#HEADER" ; it works fine on my equipment ; on
Windows somebody working with the text file encoded in utf-8 told me that
there is problem as the line containing "#HEADER" is not found !

Now I am a little bit puzzled about all this :

(a) when you write java code and compile it what happens to the
string "#HEADER" because it will be used in the following test :
if (line.equals("#HEADER") {...}
where line is read from the text file with encoding as is on the machine
where the class is executed ? in other words you are comparing what to
what ?

(b) when with a Java app you read a text file can you get its encoding
format like utf-8 or ANSI or whatever to decide about some actions to be
taken ?

I think the problem could be easily solved by replacing "#HEADER"
by "_HEADER" but I have to go to the bottom of this to understand what is
going on.
Thanks